handle username with spaces

I have to pass a username via a GET request and then take it to load a user_obj:
`$user_obj = Zenphoto_Authority::getAnAdmin(array('`user`=' => $getuser));`
The problem rises when I try to pass a username with some spaces inside, the function cannot get any admin.
Any ideas how to solve it?
Thanks

Comments

  • Don't know, certainly works for me. Are you sure you have things like case and such correct? Maybe display the `$getuser` to be sure it is what you think. For instance if it came from a URL the space might be a plus sign.
  • I solved with a `$getuser = str_replace("%20"," ",$getuser);`
  • Ok, so somehow the user name was encoded but not decoded. That would of course be open to all sorts of problems, not just spaces, but of course that depends on the actual user ids themselves.

    Best you find where you are retrieving that user name and insure it is properly handled, both in encoding and decoding.
Sign In or Register to comment.