[PHP-DEV] Re: PHP 4.0 Bug #8220 Updated: When i give unset($PHP_AUTH_USER) it's not destroying the variable From: kpsdevi <email protected>
Date: 12/13/00

Dear Sir,
Then what to do to unset that variable.Please tell me how to write LOGOUT for a user in PHP.

Waiting for ur reply

kpsdevi

> ID: 8220
> Updated by: rasmus
> Reported By: kpsdevi <email protected>
> Old-Status: Open
> Status: Closed
> Bug Type: *Function Specific
> Assigned To:
> Comments:
>
> It is destroying it, but your browser is sending it again on the next request so PHP sets it again. There is no way to tell the browser not to send this variable short of sending another 401 with a different realm. This is a browser issue and has nothing to do with PHP.
>
> Previous Comments:
> ---------------------------------------------------------------------------
>
> [2000-12-13 03:27:43] kpsdevi <email protected>
> i included the following code in one file.
>
> <?php
> if(!isset($PHP_AUTH_USER))
> {
> header('WWW-Authenticate: Basic Realm="Enter your login name and password"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization required'; exit;
> }
> else { require("mysqlconn.inc");
> $sql = "select password from users where username = '$PHP_AUTH_USER'";
> $result = mysql_query($sql,$conn); $row = mysql_fetch_array($result);
> if($PHP_AUTH_PW != $row[0])
> { header('WWW-Authenticate: Basic Realm="Authorization failed : Enter Username and password"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization required';
> mysql_free_result($result);
> mysql_close();
> exit;
> }
> mysql_free_result($result);
> mysql_close();
> }
> ?>
>
>
> I have included the following code to logout the user
>
> <?
> unset($PHP_AUTH_USER);
> ?>
>
> but it's not destroying the variable $PHP_AUTH_USER.
>
>
>
> ---------------------------------------------------------------------------
>
>
> Full Bug description available at: http://bugs.php.net/?id=8220
>

e-mail: kpsdevi <email protected>

-------
Pioneer Online Pvt. Ltd.
     --The most realiable Internet Service Provider of AP. http://www.pol.net.in
visit : http://www.pioneernetsolutions.com

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>