note 27725 deleted from features.http-auth by alindeman
| From: | alindeman@php.net | Date: | Sat, 03 May 2003 13:44:52 +0000 |
| Subject: | note 27725 deleted from features.http-auth by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47433@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.";
}
?>