I think you guys are forgetting the most important thing, the domain name.
Seriously, If I ever need to shorten my url I would go to sites that I can trust rather than use your website which is registered in .tk. No offence but .tk is not reliable.
I suggest you get a proper domain name and don't just offer a very short url (letb.tk/a, letb.tk/22). You will have problem if you continue using this.
I suggest you use hash string like a md5 and limit it to 6 or lower like letb.tk/83jd63 something like that. Or maybe a unique like letb.tk/pAoPj.
This might come in handy, you just have to modify a bit to work with yours.
* Randomly generate a string key
* @param integer $max > 20
* @return data
function frost_generate_string( $max = 20 )
$key = 'abcdefghijkmnopqrstuvwxyz';
$key .= '0123456789';
//$key .= '_*&^%%#@!`~?';
srand( ( double )microtime()*1000000 );
$i = 2;
$data = '';
while ( $i <= $max )
$data = $data . substr( $key, rand() % 33, 1 );
Also, I think you forgot to check if the inputted url is valid. I am able to enter text strings such as (test, lala) I mean come on.
This regex would be a good idea to use
if ( ! ( preg_match( "/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $post_author_url ) ) )
// add to database
If you don't want to use the regex then you better start checking this url http://letb.tk/67
I think the both sites don't check if input is valid url.