TypechoJoeTheme

尘遇 logo

当我遇上你
排行榜
统计

php页面验证密码访问

醉书生站长
7个月前
0 评论
259 阅读
检测收录...
05/06
本文最后更新于2021年05月06日,已超过216天没有更新,若内容或图片失效,请留言反馈。

单文件简单版,本站还有另一个版本供参考:网站任意页面添加访问密码

<?php
header("Content-type: text/html; charset=utf-8");
function code($user, $pass) {
      $users = ['admin'=>'123456'];
      if(isset($users[$user]) && $users[$user] === $pass) {
        return true;
      } else {
        return false;
      }
}
if(!code(@$_SERVER['PHP_AUTH_USER'], @$_SERVER['PHP_AUTH_PW'])) {
     http_response_code(401);
     header('WWW-Authenticate:Basic realm="My website"');
     echo '需要用户名和密码才能继续访问'; 
     exit;
} else {
    
}
echo "验证成功";
本文共48个字数,您已阅读:平均阅读时长≈1分钟。
php
朗读
点赞
2
赞赏
海报
人生
欢迎
要时间嘉许,等春风得意,我正好遇上你!

微信/QQ/支付宝三合一收款码

微信
QQ
支付宝
打开微信/QQ/支付宝扫一扫,即可进行扫码打赏!
版权属于:

尘遇

最后修改:

2021 年 05 月 06 日 05 : 20 PM

本文链接:

https://chenyu.me/1376.html(转载时请注明本文出处及文章链接)

暂无评论

光阴者,百代之过客

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. 小斌秀才
    2021-12-07
  2. GGHZT贡士
    2021-12-06
  3. 米奇秀才
    2021-12-06
  4. GGHZT贡士
    2021-12-04

    {!{data:image/webp;base64,UklGRpIEAABXRUJQVlA4WAoAAAAwAAAAtQMAKwEASUNDUBgCAAAAAAIYAAAAAAIQAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAAHRyWFlaAAABZAAAABRnWFlaAAABeAAAABRiWFlaAAABjAAAABRyVFJ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