Day 2 re-dseign ;p
http://minify.me for the lazy scrollers
roph help:
db_connect();
do {
$short_url = generate_url();
$suffix = $short_url{0};
$result = mysql_query("SELECT url, short_url FROM url_{$suffix} WHERE short_url = '$short_url' OR url = '$url'") or die(mysql_error());
$count = mysql_num_rows($result);
if ($count > 0) {
$row = mysql_fetch_row($result);
if (stripslashes($row[0]) == $url) {
break;
}
}
else {
mysql_query("INSERT INTO url_{$suffix} (short_url, url, created) VALUES ('$short_url', '".mysql_real_escape_string($url)."', NOW())") or die(mysql_error());
break;
}
} while ($count > 0);
$short_url = "http://".$config['domain']."/".((!$config['rewrite']) ? "?" : "").$short_url;
$short_length = strlen($short_url);
$percent = $length / $short_length;
I suck with mysql and php of course.
how would I add another 'table'? in mysql so it can add +1 to it's value everytime the script is ran? and then call that number using a variable? so I can keep count of how many url's converted. thanks