а собственно зачем их уничтожать ?!?Как уничтожить PHP_AUTH_USER и PHP_AUTH_PW
<html>
<head>
<title>
Logout
</title>
</head>
<body onload="CloseSelf();">
<script language="JavaScript">
function CloseSelf()
{
window.opener = top;
window.close();
}
</script>
<a href="" onclick="window.close()">Для Logout жми сюда</a>
</body>
</html>
session_start();
session_unset();
session_destroy();
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
Setcookie(session_name(),"");
Setcookie("SESSID","");
Header("Location: auth.php");
ты не мог юы пояснить немного вербальными комментариями этот поток сознания?session_start();
session_unset();
session_destroy();
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
Setcookie(session_name(),"");
Setcookie("SESSID","");
Header("Location: auth.php");
<?
if(!$PHP_AUTH_USER && !$PHP_AUTH_PW)
{
header('WWW-Authenticate: Basic realm="Realm-Name"');
header("HTTP/1.0 401 Unauthorized");
} else {
$HOST = "***";
$USER = "***";
$PASS = "***";
$db_name = "***";
$link = mysql_connect($HOST, $USER, $PASS);
mysql_select_db($db_name);
$query = "SELECT * FROM users WHERE LOGIN='".$PHP_AUTH_USER."' AND PASS='".$PHP_AUTH_PW."' LIMIT 1 ";
$user_result = mysql_query($query);
if(mysql_num_rows($user_result) > 0)
{
$line = mysql_fetch_array($user_result);
$select = $line[ID];
session_start();
$valid_user = "admin";
session_register("valid_user");
header("Location: index.php?stat=0");
Setcookie ("user_cookie",$select);
exit();
}
header('WWW-Authenticate: Basic realm="Realm-Name"');
header("HTTP/1.0 401 Unauthorized");
}
?>
<center><b>Not authorized</b></center>