Skip to content


简单Basic验证

if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
$_SERVER['PHP_AUTH_USER'] != ‘ADMIN_USERNAME’ ||$_SERVER['PHP_AUTH_PW'] != ‘ADMIN_PASSWORD’) {
Header(”WWW-Authenticate: Basic realm=\”Login\”");
Header(”HTTP/1.0 401 Unauthorized”);

echo <<<eob

Rejected!

Wrong Username or Password!

EOB;
exit;
}

Posted in php, 技术.

Tagged with .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.