46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
require __DIR__ . '/auth.php';
|
|
|
|
$err = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$u = $_POST['user'] ?? '';
|
|
$p = $_POST['pass'] ?? '';
|
|
if ($u === ADMIN_USER && $p === ADMIN_PASS) {
|
|
$_SESSION['admin'] = true;
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
$err = '账号或密码错误';
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>登录</title>
|
|
<style>
|
|
body { font-family:-apple-system,"Segoe UI","Microsoft YaHei",sans-serif;
|
|
background:#f7f8fa; display:flex; align-items:center; justify-content:center;
|
|
height:100vh; margin:0; }
|
|
.box { background:#fff; padding:32px 28px; border-radius:10px;
|
|
box-shadow:0 2px 12px rgba(0,0,0,.08); width:300px; }
|
|
h1 { font-size:18px; margin:0 0 20px; }
|
|
input { width:100%; padding:9px 12px; margin-bottom:12px; box-sizing:border-box;
|
|
border:1px solid #ddd; border-radius:6px; font-size:14px; }
|
|
button { width:100%; padding:10px; background:#1677ff; color:#fff; border:none;
|
|
border-radius:6px; font-size:14px; cursor:pointer; }
|
|
button:hover { background:#0e5fd8; }
|
|
.err { color:#d33; font-size:13px; margin-bottom:12px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<form class="box" method="post">
|
|
<h1>崩溃报告后台</h1>
|
|
<?php if ($err): ?><div class="err"><?= htmlspecialchars($err) ?></div><?php endif; ?>
|
|
<input name="user" placeholder="账号" autocomplete="username">
|
|
<input name="pass" type="password" placeholder="密码" autocomplete="current-password">
|
|
<button type="submit">登录</button>
|
|
</form>
|
|
</body>
|
|
</html>
|