如何在PHP中进行身份认证
发布人:shili8
发布时间:2022-12-08 08:06
阅读次数:18
<?
if(!isset($php_auth_user))
{
header("www-authenticate: basic realm=请输入你的用户名和密码:");
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
else
{
if ($php_auth_user!="username" or $php_auth_pw!="password")
{
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
}
?>
if(!isset($php_auth_user))
{
header("www-authenticate: basic realm=请输入你的用户名和密码:");
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
else
{
if ($php_auth_user!="username" or $php_auth_pw!="password")
{
header("http/1.0 401 unauthorized");
echo "验证失败,你不能网络资源!";
exit;
}
}
?>