JsusSalv Posted June 29, 2008 Share Posted June 29, 2008 Hello: The system I am working with is the Boonex Dolphin Social Network. The gal I'm working with wanted me to change the login so that members use their email address instead of the default username/login which Boonex calls 'NickName.' However, I'm coming across a fews issues. The way Dolphin works is by creating member profiles using the NickName, which doesn't allow for spaces and the link to the profile looks like this: www.domain.com/USERNAME. I've successfully modified the preg_match associated with the login form so it allows for spaces between the first and last names. Now, to access the account, the member simply navigates to www.domain.com/USER NAME. The problem now arises with Linux not liking whitespace/spaces within the system which it replaces with '%20.' The URL for the member profile now looks like this: www.domain.com/USER%20NAME. The URL is now invalid because the member system is not set up to work with spaces. Can someone tell me where the problem is? Is Linux the problem? Do I need to modify the regex so the %20 doesn't show up? What suggestions can I get from everyone? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/112399-solved-linux-problem-using-single-space-s-and-member-profile-url/ Share on other sites More sharing options...
Grayda Posted June 30, 2008 Share Posted June 30, 2008 Hi Jsus, the %20's are added by the web browser, not by the server. You can use urldecode() to remove the %20 and any other codes that come from people having accents and other bits in their name: $username = urldecode($_GET["UsernameFromURL"]; // This will return USER NAME rather than USER%20NAME You can also force Boonex to convert spaces to underscores which would be better for applications and such, but a little tricker to implement I would think: createUsername("USER", "NAME"); // ... function createUsername($firstname, $lastname) { $username = $firstname . "_" . $lastname; addUserToDatabase($username); echo "Thankyou for registering. You can now log in via www.domain.com/" . $username But urldecode and urlencode would help you sort out people with non-standard characters in their username / realname. Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/112399-solved-linux-problem-using-single-space-s-and-member-profile-url/#findComment-577690 Share on other sites More sharing options...
JsusSalv Posted June 30, 2008 Author Share Posted June 30, 2008 Awesome! Thank you. That's what I needed to know. Im savvy around PHP/MySQL but wasn't knowledgeable on this stuff. Yes, you are right about the browser parsing spaces as %20. I was thinking about file names having spaces, which Linux does not like yet IIS does. Anyhow, that's for another story. I will implement your methods for correcting my issues with Boonex. One question, would you happen to have any experience switching the login from username to email address on Boonex? I've found the PHP code-blocks that process the info but no matter what I change the email won't process for logins. The actual login form is not a problem, just a matter of switching the NAME field to Email instead of the ID. But I can't seem to get Email to verify for the login. Again, thank you for your help..it was exactly was I was looking for! Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/112399-solved-linux-problem-using-single-space-s-and-member-profile-url/#findComment-577700 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.