note 27725 added to features.http-auth
| From: | spamsyntax at sisna dot com | Date: | Tue, 17 Dec 2002 01:49:37 +0000 |
| Subject: | note 27725 added to features.http-auth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40992@lists.php.net to get a copy of this message | ||
Here is a script that has a log out link:
<?php
$realm="RealmName ( ".strftime("%c",time())." )";
if ((!isset($_SERVER['PHP_AUTH_USER'])) || ((isset($_SERVER['PHP_AUTH_USER']))
&& ($_SERVER['QUERY_STRING'] == "logout")))
{
header('WWW-Authenticate: Basic realm="' . $realm . '"');
header('HTTP/1.0 401 Unauthorized');
echo 'You did not login with a valid username/password.<br />';
exit;
}
else
{
echo "Hello {$_SERVER['PHP_AUTH_USER']}.<br />";
echo "You entered {$_SERVER['PHP_AUTH_PW']} as your password.<br />";
echo "<a href='?logout'>Click here</a> to logout.";
}
?>
--
http://www.php.net/manual/en/features.http-auth.php
http://master.php.net/manage/user-notes.php?action=edit+27725
http://master.php.net/manage/user-notes.php?action=delete+27725
http://master.php.net/manage/user-notes.php?action=reject+27725