Jump to content

Recommended Posts

If I want to mod rewrite peopel to be able to look at users's profiles by going to:

mysite.com/users/username

 

Would I need to make that username in that link a username Hash?

 

in other words make it url safe?

 

If thats the case, the username hashes stored in the database would have to be unique, correct?

 

And if thats the case, is there a list of acceptable characters to use for a url safe hash?

 

I know you are supposed to convert spaces to dashes, but can you have periods, underscores, etc?

 

Also, I'll need to create a hash for users playlists.

When a user creates a playlist and they give it a name, eventually, I'll let them link to that playlist

ex)

mysite.com/userplaylist/username/playlistname

 

I assume I will have to use the username Hash and the playlistname hash for that link.

 

Problem is, a user will be able to create the name for the playlist and they will be allowed to use spaces in the name.  I assume I will have to convert that name into a playlistname hash that is unique to the user.

 

What is a user creates a playlist name: Rock-Good

and that same user creates another playlist: Rock Good

 

When I convert the playlist name to a hash, those two will be equal.  Is my only solution here to prevent users from using dashes in a playlist name?

 

thanks for any advice and tips.

 

 

Link to comment
https://forums.phpfreaks.com/topic/145638-creating-safe-hash-names/
Share on other sites

Well, you can have spaces in the url, but they just appear as %20.

 

And if you're storing the playlists in a mysql database, you can either set the name column to not allow duplicates, or you can check to see if a playlist name already exists, and if it does, stick a random number on the end.

 

:)

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.