unset $PHP_AUTH_USER
| From: | Very Penguin | Date: | Wed, 07 Nov 2001 18:23:46 +0000 |
| Subject: | unset $PHP_AUTH_USER | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73773@lists.php.net to get a copy of this message | ||
Hi all,
I am new to PHP.
I were practise with authentication with PHP. My problem is it only
authenticates me the first time, then $PHP_AUTH_USER keeps unchanged.
I tried to unset the $PHP_AUTH_USER as in the following script, and I could
see its value cleared, but when
I reload the the php file, the authentication box still not display.
Thanks for your help,
Dt
-----------------------------
<?php
function authenticate()
{
header("WWW-Authenticate: Basic realm=\"Sample\"");
header("HTTP/1.0 401 Unauthorized");
echo "You are not authorized to use this system";
exit;
}
if( !isset($PHP_AUTH_USER) )
{
authenticate();
}
else
{
print "Before unset: $PHP_AUTH_USER<BR>";
unset($PHP_AUTH_USER);
unset($PHP_AUTH_PW);
unset($PHP_AUTH_TYPE);
print "After unset: $PHP_AUTH_USER<BR>";
print "End";
}
?>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com