URL with random numbers/letters?
My question is this.... I have my table set up to have one column (id) to increment each time a new row is added. I want to be able to give the users the ability to tell other people about their stuff, so I could give them the link as such:
But, I'm wondering if there is a way to make the id number a little more unique? (don't know if that's the right word) For example: hot or not has this....
I'd like to have something similar to RYK8ALA-LQA at the end of the url instead of 80... if that makes sense. (Also, i don't know if this is possible, but is there a way to not say the page name like the hotornot link did?)
How can I accomplish these two things? Any help would be appreciated!
I'd assume hotornot uses PHP. Try typing ..../index.php?eid=[value]
Just like with any site, the index page is the default. You don't need to type that. You just place the question mark and the value at the end, so /directory?var=value will be the same as /directory/index.php?var=value, or /dir/?var=value.
Generating a 'random' value is not that difficult, though it depends on what you want, really. You can't have it still relate to a numerical ID in the database, so you will need to store this new ID in the database instead.
Creating a hash from the md5() function will generate a 32-character value based on input, and it will always be the same. You could use md5(time().microtime()) and get a unique value easily.
If you wanted it shorter, that would be fine, just shorter it using substr(), but that would leave a greater chance that you would run into duplicates.
Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum