I try the code but I can not pass through authentication. After I enter the user name and password.the pop-up window appear again and ask user name and password again.the program can not print out "hello ...".
<?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>";
}
?>
My question is why $_SERVER['PHP_AUTH_USER is always not existed.even if I enter user name and password.
Do I have to change settings?Please help me.
Thanks a lot