Hi, Im trying to use Http Authenticating with apache and php4.
The code im using is
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
The problem is that the php variables PHP_AUTH_USER & PHP_AUTH_PW are said to be undefined.
[Sun Feb 01 23:11:38 2004] [error] [client 127.0.0.1] PHP Notice: Undefined variable: PHP_AUTH_USER in D:\Web\login.php on line 8
[Sun Feb 01 23:11:38 2004] [error] [client 127.0.0.1] PHP Notice: Undefined variable: PHP_AUTH_PW in D:\Web\login.php on line 9
How do I fix this??
thanks.