PHP/HTTP authentication with register_globals = Off
| From: | St�phane Vinsot | Date: | Thu, 15 Nov 2001 18:53:15 +0000 |
| Subject: | PHP/HTTP authentication with register_globals = Off | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-10432@lists.php.net to get a copy of this message | ||
Hi,
i'm trying to switch to a "register_globals = Off" model to improve the
security of my site.
The problem is that when using this parameter, i can't logon anymore. The
following script always ask for my user name and password. it seems that
$PHP_AUTH_USER is not set.
What is the way to go around this if i use this option ?
thanks
Stephane Vinsot
PS: Authentication code
<?php
if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"my realm\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Acces denied\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered the password $PHP_AUTH_PW.<P>";
}
?>