I want to make a script to shorten URLs that works like Bit.ly.
If a Bit.ly shortened URL is, for example, bit.ly/12Rgy3
, then how do I generate the 12Rgy3
part?
I want to store this information in a database, and I want to keep the length of those random strings between 3 and 6 characters only. How do I generate these strings so that I never get duplicates? I am using PHP.