Just trying a basic PHP authentication script (printed below). When the page executes, I receive a login box, but after entering 'user' and 'password' (respectively), the login box pops up again and eventually sends me the authentication error. I am using a WAMP5 environment. Are there, perhaps, any Apache or PHP5 directives that need to be adjusted?
if ((!isset($_SERVER['PHP_AUTH_USER'])) || (!isset($_SERVER['PHP_AUTH_PW']))
|| ($_SERVER['PHP_AUTH_USER'] != 'user') || ($_SERVER['PHP_AUTH_PW'] != 'password')) {
header('WWW-Authenticate: Basic realm="Secret Page"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authentication Unsuccessful.';
exit;
}else{echo("success");}
Thanks - Chris