$_SERVER['PHP_AUTH_USER'] does not return value
| From: | P Lok | Date: | Fri, 02 May 2003 06:50:11 +0000 |
| Subject: | $_SERVER['PHP_AUTH_USER'] does not return value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146065@lists.php.net to get a copy of this message | ||
The $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] do not get/return
value when I try the HTTP authentication example from php manual.Anyone can
tell me what pre-requisite(setting) is require in PHP.ini?I am using
PHP4.3.1 and apache 2.0.45 on Win2000.HTTP Authentication example on Chapter
16: <?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>";
}
?>Rgds./pl