Home >Backend Development >PHP Tutorial >How to authenticate in PHP_PHP Tutorial

How to authenticate in PHP_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-21 16:02:23920browse

if(!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate: Basic realm=Please enter your username and password:");
Header("HTTP /1.0 401 Unauthorized");
echo "Authentication failed, you cannot access network resources! ";
exit;
}
else
{
if ($PHP_AUTH_USER!="username " or $PHP_AUTH_PW!="password")
{
Header("HTTP/1.0 401 Unauthorized");
echo "Authentication failed, you cannot access network resources!";
exit;
}
}

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316600.htmlTechArticle? if(!isset($PHP_AUTH_USER)) { Header(WWW-Authenticate: Basic realm=Please enter your Username and password:); Header(HTTP/1.0 401 Unauthorized); echo Authentication failed, you cannot network resources...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn