- Impact
- 18
PHP:
<?php
if(isset($_SERVER['QUERY_STRING'])){
if( ( strlen($_SERVER['QUERY_STRING']) == 4 ) ){
$qs = $_SERVER['QUERY_STRING'];
include(config.php); // connect to DB and stuff...
// now we need to find the id...
$sql = "SELECT * FROM 6yd_short_url WHERE id='$qs'";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if($num > 0){
$redirect = mysql_fetch_array($result);
header("location: ".$redirect['url']);
}
else{
header("location: shorturl");
}
}
}
?>
Now, if I put in http://6yd.net/?c43c (which is in my database - redirecting to http://poordoggie.co.uk) it dosen't seem to find it, and instead redirects to http://6yd.net/shorturl (which redirects back to http://6yd.net/index.php)... I don't know what is wrong, there don't seem to be any error messages... can anyone help?
Thanks
Tom







