ZenphotoCMS Forum
handle username with spaces - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: handle username with spaces (/thread-10440.html)



handle username with spaces - BigLouis87 - 2012-09-26

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




handle username with spaces - sbillard - 2012-09-27

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.




handle username with spaces - BigLouis87 - 2012-09-29

I solved with a $getuser = str_replace("%20"," ",$getuser);




handle username with spaces - sbillard - 2012-09-29

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.