Code:
<?php
$base="db";
$connect=mysql_connect('localhost','username','password') or die("Could not connect to database!!!!");
mysql_select_db($base,$connect) or die("Count not find database table!");
if(isset($_POST['zip'])){
$zip=htmlspecialchars(mysql_real_escape_string($_POST['zip']));
$res=mysql_fetch_assoc(mysql_query("SELECT url FROM redirect WHERE zip='$zip'"));
header('Location: '.$res['url']);
exit;
}
else{
header('Location: http://www.mywebsite.com/not-listed.html');
}
?>
Comment