如何创建一个需要密码才可以打开得.html

V 星光 V11  (UID: 1544) 守护神 X [复制链接]
帖子链接已复制到剪贴板
帖子已经有人评论啦,不支持删除!

3072 29

下面这段代码是用AI生成得,但有个bug,就是人家右键查看源代码就可以看到密码了

有啥办法可以创建密码,但无法通过查看源代码找到,不需要后台

只是想输入密码后可以看到iframe代码模块

ps:上次在论坛看到有个大佬得 AI页面 就是输入密码才可以打开得

  <!DOCTYPE html>
  <html>
  <head>
  <title>Protected Page</title>
  <style>
  body {
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  }
   
  input {
  margin-bottom: 10px;
  }
   
  #iframeContainer {
  display: none;
  width: 80%;
  }
   
  #iframeContainer iframe {
  width: 100%;
  height: 80vh;
  }
  </style>
  </head>
  <body>
  <div id="passwordForm">
  <input type="password" id="passwordInput" placeholder="Enter password" />
  <button type="button" onclick="checkPassword()">Submit</button>
  </div>
   
  <div id="iframeContainer">
  ///这里放iframe代码
  </div>
   
  <script>
  function checkPassword() {
  var password = document.getElementById("passwordInput").value;
  if (password === "abc") {
  document.getElementById("passwordForm").style.display = "none";
  document.getElementById("iframeContainer").style.display = "block";
  }
  }
  </script>
  </body>
  </html>
   
域名列表 1.LS
已有评论 ( 29 )
  • 头像
    V ROYWANG (UID: 539)
    1楼

    你或许可以尝试一下使用  http  basic  认证?

  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    2楼
    ROYWANG 你或许可以尝试一下使用 http basic 认证?

    表情

  • 头像
    加菲酷猫 (UID: 690)
    3楼

    用java开发。

  • 头像
    V 橙梓 (UID: 553)
    4楼

    写一个摘要加密的密码或者非对称加密的密码,就不怕看源码了

  • 头像
    幻影 (UID: 2412)
    5楼

    <!DOCTYPE  html>

    <html>

    <head>

    <title>需要密码的HTML</title>

    <script>

    function  checkPassword()  {

        var  password  =  document.getElementById("password").value;

        if  (password  ===  "your_password")  {  //  将"your_password"替换为您设定的密码

            window.location.href  =  "protected.html";  //  输入正确密码后跳转到受保护的HTML页面

        }  else  {

            alert("密码错误,请重试!");  //  输入错误密码时弹出提示框

        }

    }

    </script>

    </head>

    <body>

    <h1>请输入密码:</h1>

    <input  type="password"  id="password">

    <button  onclick="checkPassword()">提交</button>

    </body>

    </html>

  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    6楼
    幻影 需要密码的HTML function checkPassword() { var password = document.getElementById("passwo ...

    表情  我试试

  • 头像
    川建国 (UID: 2435)
    7楼

    我这种直接让AI写

  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    8楼
    川建国 我这种直接让AI写

    我发出来得就是ai写得表情

  • 头像
    amdyyds (UID: 2291)
    9楼

    我建议是用php加参数形式。

    js属于前端,f12就能看见密码,不安全

  • 头像
    虫子跑了 (UID: 2052)
    10楼

    最简单的是js但是如上所说f12就能看到

  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    11楼
    amdyyds 我建议是用php加参数形式。 js属于前端,f12就能看见密码,不安全

    算了,就用这个了,反正也不是很重要得东西

  • 头像
    熊猫 (UID: 1800)
    12楼
    ##创建一个名为 config.js 的新文件,并将以下代码复制到该文件中:
    var password = "your_password";
    
    
    ##静态页面
    <!DOCTYPE html>
    <html>
    <head>
      <title>密码保护页面</title>
    </head>
    <body>
      <h2>请输入密码以访问页面:</h2>
      <form id="passwordForm" onsubmit="checkPassword(event)">
        <input type="password" id="passwordInput" required>
        <button type="submit">提交</button>
      </form>
    
      <script src="config.js"></script>
      <script>
        function checkPassword(event) {
          event.preventDefault(); // 阻止表单提交
    
          var input = document.getElementById("passwordInput").value;
    
          if (input === password) {
            window.location.href = "protected_page.html"; // 输入正确,跳转到受保护的页面
          } else {
            alert("密码错误,请重新输入!");
          }
        }
      </script>
    </body>
    </html>
    ##config.js 文件处于安全位置,并适当保护您的密码信息
  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    13楼
    熊猫 ##创建一个名为 config.js 的新文件,并将以下代码复制到该文件中: var password = "your_password"; ##静态页面 & ...

    谢谢大佬

  • 头像
    LWQ (UID: 1822)
    14楼
    東璃 谢谢大佬

    这个不行…  打开页面js直接输入password就能看见了…

  • 头像
    LWQ (UID: 1822)
    15楼

    页面挂在哪里  有后端吗

  • 头像
    V 星光 V11 (UID: 1544) 守护神 X
    (域名列表 1.LS)
    16楼
    LWQ 这个不行… 打开页面js直接输入password就能看见了…

    无所谓了,反正也不重要

  • 头像
    LWQ (UID: 1822)
    17楼
    東璃 无所谓了,反正也不重要

    需要我给你整个高级的🤣

  • 头像
    V 胖虎_ (UID: 2112)
    18楼

    md5不可以吗,使用把拿到的明文进行md5去判断是否和你设置的密码md5相同

  • 头像
    LWQ (UID: 1822)
    19楼
    胖虎_ md5不可以吗,使用把拿到的明文进行md5去判断是否和你设置的密码md5相同

    md5很方便  就是要有后端支持  不然数据在页面上  肯定是能拿到的

  • 头像
    V 胖虎_ (UID: 2112)
    20楼
    LWQ md5很方便 就是要有后端支持 不然数据在页面上 肯定是能拿到的

    密码设置复杂点,他拿到md5也不是太容易破解吧

域名市场
   域名载入中...
创建新帖
自助推广购买广告位
确认删除
确定要删除这篇帖子吗?删除后将无法恢复。
删除成功
帖子已成功删除,页面将自动刷新。
删除失败
删除帖子时发生错误,请稍后再试。