PHP首部认证
程序员文章站
2022-05-03 09:52:05
...
PHP首部认证
// User name and password for authentication$username = 'rock';
$password = 'roll';
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) {
// The user name/password are incorrect so send the authentication headers
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Guitar Wars"');
exit('Guitar Wars
Sorry, you must enter a valid user name and password to access this page.');
}
?>
').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
以上就介绍了PHP首部认证,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。