note 42602 added to function.header
| From: | alexandrebarboza at globo dot com | Date: | Sun, 23 May 2004 02:35:26 +0000 |
| Subject: | note 42602 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69978@lists.php.net to get a copy of this message | ||
My solution for login/logout in mysql.
<?
error_reporting(E_ERROR | E_PARSE);
session_start();
$link = mysql_connect("localhost",$_SERVER['PHP_AUTH_USER'] ,
$_SERVER['PHP_AUTH_PW']);
if (!$link || $_SESSION['logout']) {
unset($_SESSION['logout']);
header('WWW-Authenticate: Basic realm="MySQL"');
header('HTTP/1.0 401 Unauthorized');
echo 'Access denied.';
} else {
if ($_GET['Logout'] == "True") {
$_SESSION['logout'] = true;
echo '<a
href="'.$_SERVER['PHP_SELF'].'">Login</a>';
} else {
echo '<a
href="'.$_SERVER['PHP_SELF'].'?Logout=True">Logout</a>';
}
}
mysql_close($link);
?>
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42602
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42602&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42602&report=yes
Search -- http://master.php.net/manage/user-notes.php