HTTP authentication logout
| From: | David A Dickson | Date: | Tue, 03 Jul 2001 17:52:36 +0000 |
| Subject: | HTTP authentication logout | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56029@lists.php.net to get a copy of this message | ||
I am using HTTP authentication to restrict access to certain pages and I want to add a logout option
so that users must reauthenticate before being able to veiw the pages again.
Here is the code I'm using to authenticate:
<?
/* Test for username/password */
if(($PHP_AUTH_USER == $username) && ($PHP_AUTH_PW == $password)){
startAdminPage();
endPage();
}
else{
/* Send headers to cause a browser to request username and password */
header("WWW-Authenticate: Basic realm=\"Administrative Area\"");
header("HTTP/1.0 401 Unauthorized");
/* Show failure text */
startPage();
print("<P>This page requires a user name and password to view.<P>");
endPage();
}
?>
For the logout option I tried just setting $PHP_AUTH_USER="" and $PHP_AUTH_PW=""
but that didn't work. Any ideas on how I can do this?
---
: David A. Dickson
: daviddickson@lycos.com
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/