note 21712 deleted from features.http-auth by philip
| From: | philip@php.net | Date: | Tue, 16 Jul 2002 18:39:40 +0000 |
| Subject: | note 21712 deleted from features.http-auth by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33171@lists.php.net to get a copy of this message | ||
If you want to access $PHP_AUTH_USER or $PHP_AUTH_PW variables via the $GLOBALS variable, here is
the good path:<p>
$GlOBALS[_SERVER][$PHP_AUTH_USER]
and
$GlOBALS[_SERVER][$PHP_AUTH_PW]
<p>
In the messages above [_SERVER] was unspecified.
<p>
This is useful when you want to unset those variables in a function; then your test for the HTTP
login prompt would be:
<p>
if ((!isset($PHP_AUTH_USER)) || ($PHP_AUTH_USER=="")
{
header("WWW-Authenticate: Basic realm=\"Login process\"");
header("HTTP/1.0 401 Unauthorized");
...
}
else
{
if ( =>here test if log/pass are the good one<= )
{
... ok
}
else
{
$GLOBALS['_SERVER']['PHP_AUTH_USER'="";
...error message, user could log again
}
}