功能模块: - 观影记录:列表(瀑布流)/ 添加 / 编辑 / 详情 / 删除,删除时同步清理图片文件 - 首页快捷搜索 + 高级搜索(片名、影院、观影人、日期区间组合筛选) - 影院管理:三段式信息 + 50 种预设配色,删除已引用影院时二次确认 - 观影人管理:头像裁剪上传 + 专属配色,已引用者禁止删除 - 图片处理:Cropper.js 裁剪票根/海报/观影照片/头像,多图上传,首字母 SVG 头像兜底 - OMDb 自动获取影片信息(fetch_movie.php 代理,返回 JSON) - CSV 批量导入:UTF-8/GBK 自动识别,影院去重,事务保护,逐行错误报告 - 统计仪表板:总览 + 按影院/观影人/年份/近 12 个月排行 - 年度报告:按账号关联的观影人视角生成,含 Chart.js 月度与星期分布图 - 多用户:账号增删改、账号与观影人绑定、修改自己的用户名与密码 - 登录鉴权:Session + password_hash,全站页面登录校验 文档: - 重写 README:功能特性、技术栈、目录结构、数据库结构、部署与使用指南、接口说明、CSV 格式、安全注意事项、已知限制 - 新增 .gitignore,排除 db/ 与 uploads/ 等运行时数据
199 lines
5.9 KiB
PHP
199 lines
5.9 KiB
PHP
<?php
|
|
// ============================================
|
|
// 文件: login.php
|
|
// 说明: 管理员登录页面
|
|
// ============================================
|
|
|
|
require_once 'config.php';
|
|
|
|
// 如果已登录,跳转到首页
|
|
if (isset($_SESSION['admin_id'])) {
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$username = trim($_POST['username'] ?? '');
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
if (empty($username) || empty($password)) {
|
|
$error = '请输入用户名和密码';
|
|
} else {
|
|
$db = getDB();
|
|
$stmt = $db->prepare("SELECT * FROM admins WHERE username = ?");
|
|
$stmt->execute([$username]);
|
|
$admin = $stmt->fetch();
|
|
|
|
if ($admin && password_verify($password, $admin['password'])) {
|
|
$_SESSION['admin_id'] = $admin['id'];
|
|
$_SESSION['admin_username'] = $admin['username'];
|
|
header('Location: index.php');
|
|
exit;
|
|
} else {
|
|
$error = '用户名或密码错误';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>电影全纪录 - 登录</title>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<style>
|
|
/* 登录页专用样式 */
|
|
body {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
|
|
margin: 0;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
}
|
|
.login-container {
|
|
background: rgba(255,255,255,0.05);
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border: 1px solid rgba(255,255,255,0.1);
|
|
border-radius: 24px;
|
|
padding: 48px 40px;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
box-shadow: 0 30px 80px rgba(0,0,0,0.5);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
.login-container:hover {
|
|
transform: translateY(-4px);
|
|
}
|
|
.login-logo {
|
|
text-align: center;
|
|
margin-bottom: 36px;
|
|
}
|
|
.login-logo .icon {
|
|
font-size: 52px;
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
}
|
|
.login-logo h1 {
|
|
color: #fff;
|
|
font-size: 28px;
|
|
font-weight: 700;
|
|
margin: 0;
|
|
letter-spacing: 2px;
|
|
}
|
|
.login-logo p {
|
|
color: rgba(255,255,255,0.5);
|
|
font-size: 14px;
|
|
margin: 6px 0 0;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
color: rgba(255,255,255,0.7);
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
margin-bottom: 6px;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 14px 18px;
|
|
background: rgba(255,255,255,0.08);
|
|
border: 1px solid rgba(255,255,255,0.12);
|
|
border-radius: 12px;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
transition: all 0.3s ease;
|
|
box-sizing: border-box;
|
|
outline: none;
|
|
}
|
|
.form-group input:focus {
|
|
border-color: #e67e22;
|
|
background: rgba(255,255,255,0.12);
|
|
box-shadow: 0 0 0 4px rgba(230,126,34,0.15);
|
|
}
|
|
.form-group input::placeholder {
|
|
color: rgba(255,255,255,0.3);
|
|
}
|
|
.btn-login {
|
|
width: 100%;
|
|
padding: 14px;
|
|
background: linear-gradient(135deg, #e67e22, #f39c12);
|
|
border: none;
|
|
border-radius: 12px;
|
|
color: #fff;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
margin-top: 8px;
|
|
letter-spacing: 1px;
|
|
}
|
|
.btn-login:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 10px 30px rgba(230,126,34,0.3);
|
|
}
|
|
.btn-login:active {
|
|
transform: translateY(0);
|
|
}
|
|
.error-msg {
|
|
background: rgba(231,76,60,0.2);
|
|
border: 1px solid rgba(231,76,60,0.3);
|
|
color: #e74c3c;
|
|
padding: 12px 16px;
|
|
border-radius: 10px;
|
|
font-size: 14px;
|
|
margin-bottom: 16px;
|
|
text-align: center;
|
|
}
|
|
.login-footer {
|
|
text-align: center;
|
|
margin-top: 24px;
|
|
color: rgba(255,255,255,0.3);
|
|
font-size: 13px;
|
|
}
|
|
@media (max-width: 480px) {
|
|
.login-container {
|
|
padding: 32px 24px;
|
|
margin: 16px;
|
|
border-radius: 16px;
|
|
}
|
|
.login-logo h1 {
|
|
font-size: 24px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
<div class="login-logo">
|
|
<span class="icon">🎬</span>
|
|
<h1>电影全纪录</h1>
|
|
<p>记录每一帧感动</p>
|
|
</div>
|
|
|
|
<?php if ($error): ?>
|
|
<div class="error-msg"><?= h($error) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST" action="">
|
|
<div class="form-group">
|
|
<label>管理员账号</label>
|
|
<input type="text" name="username" placeholder="请输入用户名" value="<?= h($_POST['username'] ?? '') ?>" autofocus>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>密码</label>
|
|
<input type="password" name="password" placeholder="请输入密码">
|
|
</div>
|
|
<button type="submit" class="btn-login">登 录</button>
|
|
</form>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|