Answer the question
In order to leave comments, you need to log in
Unique URL generation?
There is a need to generate a unique URL in the php + mySQL bundle like bit.ly or clck.ru.
What are the options? Unixtime generation, hashes?
The URL needs to be short, so the most banal version with MD5 disappears immediately. The option with a digital id is bad because at first the links will be short, and then lengthen. Yes, and there will be "Geta". We need such an option that "everyone is equal."
Answer the question
In order to leave comments, you need to log in
You can find the shortener sources at these links:
code.google.com/p/phurl/
www.webresourcesdepot.com/7-open-source-and-free-url-shortener-scripts-to-create-your-own/
briancray. com/2009/08/26/free-php-url-shortener-script/
As far as I know they all work the same way. You can see a typical translation function in the phurl source:
code.google.com/p/phurl/source/browse/phurl-includes/functions.php - compressNumber function, which translates some random number into 62-decimal number system
It all depends on how many links you plan to shorten. If there are a lot of them, then sooner or later links will appear, the abbreviated URL of which will be longer than the URL of the first links.
and what prevents you from taking MD5 from the current unixtime and cutting it to length, taking, say, the first 5 characters?
If you are making a short link service, you still need to store "long" links in the database. So for generation it is possible to use table ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question