I'm new to PHP. I wrote this simple authentication script and it seems to be working except I can't figure out the proper syntax to get the script to forward a user to a certain url after entering the correct username and password. Any help would be appreciated.
Here is the script:
<?
if ((!$username) || (!$password)) {
header("Location: http://www.flauntstudios.com/clients/index.shtml");
exit;
}
$db_name = "clients";
$table_name = "auth_users";
$connection = @mysql_connect("localhost", "flauntstudios", "flauntit")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "SELECT * FROM $table_name
WHERE username = \"$username\" AND password = password(\"$password\")
";
$result = mysql_query($sql)
or die ("Can't execute query.");
$num = mysql_numrows($result);
if ($num != 0) {
header("Location: http://$url");
exit;
} else {
header("Location: http://www.flauntstudios.com/clients/index.shtml");
exit;
}
?>