网页添加访问密码/nginx隐藏真实地址

2022-08-08 0 879

教程前言:

一款简单的网页访问密码,当然只是简单的限制访问,配合nginx 隐藏真实地址后不定型期修改伪地址效果更加哦!

 

代码如下:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    </head>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
            outline: none;
            box-sizing: border-box;
        }
        body{
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            background: linear-gradient(135deg,#56c8ff,#6f99fc) no-repeat;

        }
        .wrapper{
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 450px;
            background-color: #fff;
            padding: 30px;
            box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
        }
        .wrapper .input-data{
            width: 100%;
            height: 40px;
            position: relative;
        }
        .wrapper .input-data input{
            width: 100%;
            height: 100%;
            border: none;
            border-bottom: 2px solid silver;
            font-size: 15px;
        }
        .input-data input:focus ~ label,
        .input-data input:valid ~ label{
            transform: translateY(-20px);
            font-size: 15px;
            color: #4158D0;
        }
        .wrapper .input-data label{
            position: absolute;
            bottom: 10px;
            left: 0;
            color: grey;
            pointer-events: none;
            transition: all 0.3s ease;
        }
        .wrapper .input-data .underline{
            position: absolute;
            bottom: 0px;
            height: 2px;
            width: 100%;
        }
        .input-data .underline:before{
            position: absolute;
            content: "";
            height: 100%;
            width: 100%;
            background: #1E90FF;
            transform: scaleX(0);
            transition:transform 0.3s ease;
        }
        .input-data input:focus ~ .underline:before,
        .input-data input:valid ~ .underline:before{
            transform: scaleX(1);
        }
        .send-btn {
            position: relative;
            background-color: #1E90FF;
            border: none;
            font-size: 15px;
            color: #ffffff;
            padding: 8px;
            width: 150px;
            text-align: center;
            transition-duration: 0.6s;
            text-decoration: none;
            overflow: hidden;
            cursor: pointer;
            border-radius: 5px;
            margin-top: 20px;
        }
        .send-btn::after {
            content: '';
            background: #53a4f0;
            display: block;
            position: absolute;
            padding-top: 300%;
            padding-left: 350%;
            margin-left: -20px !important;
            margin-top: -120%;
            opacity: 0;
            transition: all 0.8s;
        }
        .send-btn:active::after {
            padding: 0;
            margin: 0;
            opacity: 1;
            transition: 0s;
        }
    </style>
    <body>
        <form action="/token.php" method="post">
            <div class="wrapper">
                <div class="input-data">
                    <input type="text" name="token"/>
                    <div class="underline"></div>
                    <label>访问密码</label>
                </div>
                <button class="send-btn">进入</button>
            </div>
        </form>
    </body>
</html>
<?php
    header("content-type:text/html;charset=utf-8");
     // 接收令牌字段
    $url_token = $_POST['token'];
    // 自定义令牌
    $custom_token = 'jiuyan';
    // 密码正确跳转地址
    $request_path = "/usa";
    // 验证密码
    if($url_token == $custom_token) {
        header("Location: $request_path");
    }
?>

 

 

伪地址 usa 例如访问 /usa 就等于/index.html:

# 伪地址 usa 例如访问 /usa 就等于/index.html
location ~* ^/usa {
      proxy_next_upstream error timeout http_503 http_504 http_502;
      proxy_connect_timeout 500s;
      proxy_read_timeout 500s;
      proxy_send_timeout 500s;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      # 需要跳转的地址,例如:/index.html,/index.php
      rewrite  ^(.*)$  /index.html break;
      # 跳转的域名
      proxy_pass https://www.huizhanii.com;
}

 

收藏 (0)

微信扫一扫

支付宝扫一扫

点赞 (0)

免责声明

本资源仅限个人学习与研究使用,严禁用于任何商业用途!

1 网站名称:汇站网
2 永久网址:https://www.huizhanii.com
3 本站资源来源于网友投稿和付费购买,仅供编程人员及源代码爱好者下载参考与研究,不提供任何技术支持服务!
4 资源展示图片及相关信息仅供参考,不代表本站立场!本站仅作为信息存储平台
5 禁止在服务器和虚拟机上搭建运营,所有资源仅限本地调试与研究使用,不支持联网运行!
6 未经版权方授权,严禁用于商业用途。使用者如违反国家法律法规,需自行承担全部法律责任!
7 请在下载后24小时内删除!建议支持正版授权作品
8 如资源侵犯您的合法权益,请提供版权证明及相关作品信息发送至邮箱:972908224@qq.com,我们将及时处理
9 如遇下载链接失效或支付未到账,请联系站长处理
10 欢迎投稿优质源码或教程,审核通过后将获得相应奖励
11 资源收费仅用于维持网站正常运营
12 数字商品具有特殊性质,一经购买概不退款

汇站网 技术分享 网页添加访问密码/nginx隐藏真实地址 https://www.huizhanii.com/28582.html

站长资源下载中心-找源码上汇站

常见问题
  • 如果付款后没有弹出下载页面,多刷新几下,有问题联系客服!
查看详情
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情

相关文章

联系官方客服

为您解决烦忧 - 24小时在线 专业服务