
25.04.2007, 08:33
|
|
♠ ♦ ♣ ♥
Регистрация: 18.05.2006
Сообщений: 1,828
Провел на форуме: 8042357
Репутация:
3742
|
|
PHP код:
<?php
$username = $PHP_AUTH_USER;
$password = $PHP_AUTH_PW;
cfunction authenticate() {
Header("WWW-authenticate: Basic realm=\"Restrict
(".strftime("%r",time()).")\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password to access
this resource\n";
exit;
}
if($logout==1) {
setcookie("login","off");
$PHP_SELF =
str_replace("logout=1","",$PHP_SELF);
header("Location: $PHP_SELF");
exit();
}
if(!isset($username) && !isset($password) ||
$login=="off") {
setcookie("login","on");
authenticate();
} else {
/*
Authtentication code here
*/
if(!$auth) {
authenticate();
}
else setcookie("login","on");
}
?>
Hi <?=$PHP_AUTH_USER?> you are logged in :-)
<a href="<?=$PHP_SELF?>?logout=1">Click here to
logout</a>
__________________
Привет! Меня зовут Джордж, и я хотел бы рассказать вам про реинкарнацию (ц) 2x2
|
|
|