只需一步,快速开始
function auth () { $valid_passwords = array ("账号" => "密码"); $valid_users = array_keys($valid_passwords); $user = $_SERVER['PHP_AUTH_USER']; $pass = $_SERVER['PHP_AUTH_PW']; $validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]); if (!$validated) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); die ("Not authorized"); } }
auth();
举报
夏日弥光 发表于 2017-5-15 16:32 屌啊,要是有多用户更安逸了
$valid_passwords = array ("账号" => "密码");
$valid_passwords = array ("账号" => "密码","账号" => "密码","账号" => "密码","账号" => "密码","账号" => "密码","账号" => "密码",);
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|全球主机交流论坛
GMT+8, 2025-1-7 05:20 , Processed in 0.092766 second(s), 10 queries , Gzip On, MemCache On.
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.