Jump to content

[SOLVED] Linux problem using single space (\s) and member profile URL


Recommended Posts

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!

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 :)

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.