HIi. I'm trying to use HTTP Authentication on Linux, running an Apache server with PHP
(http://www.gill-lounge.co.uk/phpinfo.php)
Whenever I access a page with this code on it (from the PHP manual) I get the password window, but when I type in a user/password instead of printing it out on the screen, it just asks me again. After 3 times, it goes to the 401 Unauthorized page. Why doesn't it work like its supposed to?
<?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\n";
exit;
} else {
echo "<p>Hello {$SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['$PHP_AUTH_PW']} as your password.</p>";
}
?>
Thanks,
-Adam Lundrigan