I assume you already have a sql connection and you'll need to specify the correct table in the query:
PHP Code:
<?php
$id = $_GET['id'];
//validate id
if(!is_numeric($id)) :
?>
Invalid url id
<?php
else :
$query = "SELECT url FROM tableName WHERE id = '$id';";
$res = @mysql_query($query);
if(!$res) :
?>
An error has occured
<?php
else :
if($row = @mysql_fetch_array($res)) :
header('Location: ' . $row[0]);
else :
?>
URL could not be found
<?php
endif;
endif;
endif;
?>
Last edited by NullPointer; 02-04-2010 at 12:50 PM..
|