伪登陆页面代码

萝莉工坊 44 0

伪页面代码,可放置在 /admin/ 下 ,页面如下:

伪登陆页面代码

背景图片:

伪登陆页面代码

页面代码:

<?php
session_start();

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$pageTitle="Login";

$usera="admin";
$passa="admin";


if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // 判断用户名和密码是否匹配
    if ($username === $usera && $password === $passa) {
        // 登录成功,设置会话变量并重定向
        //$_SESSION['logged_in'] = true;
        //header('Location: admin.php');
echo "<script>alert('不要瞎猜密码,禁止干坏事!');</script>";//恭喜你猜对了,不过没奖励哈
        exit();
    } else {
        // 登录失败,可以显示错误信息
       echo "<script>alert('用户名或密码错误,错误5次后封禁ip!');</script>";

    }
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Login</title>
  <style>
    body {
      background: url('ocean-3605547_1280.jpg') no-repeat;
      background-size: 100% 130%;
    }

    #login_box {
      width: 20%;
      height: 400px;
      background-color: #00000060;
      margin: auto;
      margin-top: 10%;
      text-align: center;
      border-radius: 10px;
      padding: 50px 50px;
    }

    h1 {
      color: #ffffff90;
      margin-top: 5%;
    }

    #input-box {
      margin-top: 5%;
    }

    span {
      color: #fff;
    }

    input {
      border: 0;
      width: 60%;
      font-size: 24px;
      color: #fff;
      background: transparent;
      border-bottom: 2px solid #fff;
      padding: 5px 10px;
      outline: none;
      margin-top: 30px;
    }

    button {
      margin-top: 50px;
      width: 60%;
      height: 50px;
      border-radius: 25px;
      border: 0;
      color: #fff;
      text-align: center;
      line-height: 40px;
      font-size: 22px;
      background-image: linear-gradient(to right, #30cfd0, #330867);
    }

    #sign_up {
      margin-top: 45%;
      margin-left: 60%;
    }

    a {
      color: #b94648;
    }
  </style>
</head>

<body>
  <div id="login_box">
        <form action="index.php" method="post">
<h1>Login</h1>
    <div id="input_box">
                <input type="text" name="username" placeholder="用户名" required>
    </div>
    <div class="input_box">
            <input type="password" name="password" placeholder="密码"required>
    </div>

            <button type="submit">登   录</button>
       
</form>

  </div>
</body>
<script src="Read_address.js" defer></script>
</html>

Read_address.js代码:

document.addEventListener('DOMContentLoaded', function() {
    // 获取当前页面的 URL
    const currentURL = new URL(window.location.href);

    // 提取主域名
    const host = currentURL.hostname;  // 获取主机名,例如

    // 获取来访源地址(referrer)
    const referrerURL = document.referrer ? new URL(document.referrer).href : '浏览器直接访问';

    // 发送 POST 请求到 rz.php
    fetch('https://sing.ge/write/rz.php', {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            URL: currentURL.href,  // 发送完整的页面 URL
            from_URL: referrerURL, // 发送来访源地址
            host: host             // 发送主域名
        })
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('网络响应失败: ' + response.status);
        }
        return response.text(); // 返回的文本内容一般为空
    })
    .then(text => {
        console.log('数据成功发送到 rz.php:', text); // 输出记录成功的消息
    })
    .catch(error => {
        console.error('数据发送失败:', error); // 处理可能的错误
    });

    // 发送 POST 请求到 Record_address.php
    fetch('https://sing.ge/write/Record_address.php', {
        method: 'POST',
        mode: 'cors',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            URL: currentURL.href,  // 发送完整的页面 URL
            from_URL: referrerURL  // 发送来访源地址
        })
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('网络响应失败: ' + response.status);
        }
        return response.text(); // 返回的文本内容一般为空
    })
    .then(text => {
        console.log('数据成功发送到 Record_address.php:', text); // 输出记录成功的消息
    })
    .catch(error => {
        console.error('数据发送失败:', error); // 处理可能的错误
    });
});

 

发表评论 取消回复
表情 图片 链接 代码

分享