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

2022-08-08 0 889

教程前言:

一款简单的网页访问密码,当然只是简单的限制访问,配合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;
}

 

本文章已结束,如转载请注明:汇站网 » 网页添加访问密码/nginx 隐藏真实地址

收藏 (0)

微信支付 微信扫一扫

支付宝支付 支付宝扫一扫

打赏二维码
点赞 (0)

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

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

相关文章

联系官方客服

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

  •  购买了 Vikinger主题汉化版/WordPress国外超人气主题模板/ 更新至v1.9.9