limitphp Posted February 17, 2009 Share Posted February 17, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/145638-creating-safe-hash-names/ Share on other sites More sharing options...
jackpf Posted February 23, 2009 Share Posted February 23, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/145638-creating-safe-hash-names/#findComment-769496 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.