PHP AUTH登陆验证
<?php
$auth = false;
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
if ( isset($user) && isset($pass) ){if ($user=="admin"&&$pass=="admin"){
$auth = true;
}
}
if (!$auth){
header('WWW-Authenticate: Basic realm="AUTH验证"');
header('HTTP/1.0 401 Unauthorized');
echo '警告:需要用户名和密码才能继续访问!';
exit;
}
else{
echo '恭喜您,验证成功!';
}
?>
转载请注明:RAIN MAN » PHP AUTH登陆验证
标签: AUTH
还没有人抢沙发呢~