Why does this script gives an Internet Error (500)?
<?php
// File Name: log-in.php3
$auth = false; // Assume user is not authenticated
if (isset( $PHP_AUTH_USER ) && isset( $PHP_AUTH_PW))
{
include "../../php_functions/mysql.inc";
$sql = "select * from users where Username='$PHP_AUTH_USER' and Password='$PHP_AUTH_PW'";
$result = mysql_db_query($DB, $sql, $Connection);
$num = mysql_num_rows($result);
if ( $num != 0 )
{
$auth = true;
}
}
if (!$auth)
{
header ('WWW-Authenticate: Basic realm="Private"');
header ('HTTP/1.0 401 Unauthorized');
exit;
}
else
{
header ('Location: http://www.bla.nl/index.html');
echo 'Autorization succeeded.';
}
?>
Thanks in advance!
Patrick