复制代码 代码如下:
<directory "C:/program files/Apache software foundation/apache2.2/htdocs">
Options Indexes FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
复制代码 代码如下:
<?php
if(!isset($_SERVER['PHP_AUTH_USER'])){
header("WWW-Authenticate:BASIC Realm=My Realm");
header("HTTP/1.0 401 Unauthorized");
echo("账号/密码错误!");
exit;
}else{
/*获取用户名,密码进行验证*/
$user=$_SERVER['PHP_AUTH_USER'];
$pwd=$_SERVER['PHP_AUTH_PW'];
if($user=="admin"&&$pwd="password"){
echo "通过验证";
}else{
header("HTTP/1.0 401 Unauthorized");
echo "账号/密码错误!";
exit;
}
}
?>
新闻热点
疑难解答