Hi. I'm totally stumped on why this code doesn't work on my server (hosted by POWWE😎. When the bottom is executed, my user/pass dialog box never drops unless I hit cancel. Shouldn't it drop out from authenticating after I press the OK button followed by printing the name and password previously entered? I'm going through this exercise only because I consistently fail to evaluate $SERVER['PHP_AUTH_USER'] and $SERVER['PHP_AUTH_PW'].
Can someone give me a hand pleaes?
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>";
}