if (!isset($_SERVER['PHP_AUTH_USER']))
{
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must have a valid user name and password to login!';
exit;
} else
{
if ( ($_SERVER['PHP_AUTH_USER']=="auser") &&
($_SERVER['PHP_AUTH_PW']=="apassword") )
{
// echo "<p>excellent user name and password !</p>";
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must have a valid user name and password to login!';
exit;
}
}