Re: unset $PHP_AUTH_USER
| From: | Galkov Vladimir | Date: | Wed, 07 Nov 2001 19:59:50 +0000 |
| Subject: | Re: unset $PHP_AUTH_USER | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73776@lists.php.net to get a copy of this message | ||
Good day.... some time agoo I try to unset this var to .. but without
adwance to victory... so if any body know how dynamickly change the vars
($PHP_AUTH_USER, $PHP_AUTH_PW).. will be interesting to know...
But I thinck in you situation you may use this code:
<?
if (!isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW))
{
halt_access();
}
else // login & pswd are present test them!
if (test_login($PHP_AUTH_USER, $PHP_AUTH_PW))
{
echo "here procected.... ;-) zone...";
echo '<hr>';
}
else
halt_access();
}
function halt_access()
{
global $REALM;
Header( "WWW-Authenticate: Basic realm=\"$REALM\"");
Header( "HTTP/1.0 401 Unauthorized");
echo "Authorization Required\n";
exit;
}
function test_login($login, $pswd)
{
/*
now authorization functions are not present!...
may be MySQL qwery or somth special...
play whit true/false to understand how it drive....
*/
// return true;
return false;
}
?>