Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

9 changed files with 505 additions and 1110 deletions

153
admin.php
View File

@ -1,153 +0,0 @@
<?php
session_start();
if (!isset($_SESSION['admin_logged_in'])) {
header('Location: login.php');
exit;
}
require_once __DIR__ . '/db/config.php';
$pdo = db();
$message = '';
// Handle Settings Update
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_settings'])) {
$updates = [
'site_title' => $_POST['site_title'],
'site_logo' => $_POST['site_logo'],
'tg_link' => $_POST['tg_link'],
'footer_copy' => $_POST['footer_copy'],
'watermark_text' => $_POST['watermark_text']
];
foreach ($updates as $key => $val) {
$stmt = $pdo->prepare("UPDATE settings SET setting_value = ? WHERE setting_key = ?");
$stmt->execute([$val, $key]);
}
$message = '设置更新成功!';
}
// Get current settings
$settings = [];
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$settings[$row['setting_key']] = $row['setting_value'];
}
$site_logo = $settings['site_logo'] ?? 'assets/pasted-20260207-134833-7329dc42.jpg';
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>后台管理 - <?php echo htmlspecialchars($settings['site_title'] ?? '财神组聊天框架'); ?></title>
<link rel="icon" type="image/jpeg" href="<?php echo htmlspecialchars($site_logo); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<style>
:root { --admin-sidebar-width: 240px; }
body { background: #f8f9fa; }
.sidebar {
height: 100vh;
background: #212529;
color: #fff;
padding-top: 20px;
position: fixed;
width: var(--admin-sidebar-width);
z-index: 100;
}
.sidebar a { color: #adb5bd; text-decoration: none; padding: 12px 20px; display: block; transition: 0.2s; }
.sidebar a:hover, .sidebar a.active { background: #343a40; color: #fff; border-left: 4px solid #d4af37; }
.main-content {
margin-left: var(--admin-sidebar-width);
padding: 40px;
min-height: 100vh;
}
@media (max-width: 991px) {
.sidebar {
width: 100%;
height: auto;
position: fixed;
top: 0;
left: 0;
padding: 5px 0;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
justify-content: flex-start;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.main-content {
margin-left: 0;
padding: 80px 15px 20px 15px;
}
.sidebar a {
padding: 10px 15px;
white-space: nowrap;
font-size: 0.85rem;
border-left: none !important;
border-bottom: 3px solid transparent;
}
.sidebar a.active {
border-bottom: 3px solid #d4af37;
}
.sidebar hr, .sidebar .text-center { display: none !important; }
}
</style>
</head>
<body>
<div class="sidebar">
<div class="text-center mb-4 px-3">
<?php if($site_logo): ?>
<img src="<?php echo htmlspecialchars($site_logo); ?>" alt="Logo" class="img-fluid mb-2" style="max-height: 60px; border-radius: 8px;">
<?php endif; ?>
<h5 class="text-warning">财神组管理</h5>
</div>
<a href="admin.php" class="active"><i class="bi bi-gear-fill me-2"></i> 系统设置</a>
<a href="admin_steps.php"><i class="bi bi-chat-dots-fill me-2"></i> 话术管理</a>
<a href="index.php" target="_blank"><i class="bi bi-eye me-2"></i> 查看前台</a>
<a href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> 退出登录</a>
</div>
<div class="main-content">
<div class="container-fluid">
<h3>系统设置</h3>
<?php if($message): ?>
<div class="alert alert-success mt-3"><?php echo $message; ?></div>
<?php endif; ?>
<div class="card shadow-sm mt-4">
<div class="card-body p-4">
<form method="POST">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label fw-bold">网站名称</label>
<input type="text" name="site_title" class="form-control" value="<?php echo htmlspecialchars($settings['site_title'] ?? ''); ?>">
</div>
<div class="col-md-6 mb-3">
<label class="form-label fw-bold">网站 Logo/Favicon 路径</label>
<input type="text" name="site_logo" class="form-control" value="<?php echo htmlspecialchars($settings['site_logo'] ?? ''); ?>">
</div>
</div>
<div class="mb-3">
<label class="form-label fw-bold">Telegram 客服链接</label>
<input type="text" name="tg_link" class="form-control" value="<?php echo htmlspecialchars($settings['tg_link'] ?? ''); ?>">
</div>
<div class="mb-3">
<label class="form-label fw-bold">底部版权信息</label>
<textarea name="footer_copy" class="form-control" rows="2"><?php echo htmlspecialchars($settings['footer_copy'] ?? ''); ?></textarea>
</div>
<div class="mb-3">
<label class="form-label fw-bold">全屏水印文字</label>
<input type="text" name="watermark_text" class="form-control" value="<?php echo htmlspecialchars($settings['watermark_text'] ?? ''); ?>">
</div>
<div class="mt-4">
<button type="submit" name="update_settings" class="btn btn-warning px-5 fw-bold">保存全局设置</button>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,226 +0,0 @@
<?php
session_start();
if (!isset($_SESSION['admin_logged_in'])) {
header('Location: login.php');
exit;
}
require_once __DIR__ . '/db/config.php';
$pdo = db();
// Get settings for favicon and logo
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings");
$settings = [];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$settings[$row['setting_key']] = $row['setting_value'];
}
$site_logo = $settings['site_logo'] ?? 'assets/pasted-20260207-134833-7329dc42.jpg';
$message = '';
$edit_day = isset($_GET['edit']) ? (int)$_GET['edit'] : 0;
// Handle Content Update
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['update_step'])) {
$day = (int)$_POST['day_number'];
$stmt = $pdo->prepare("UPDATE steps SET
title = ?, what_to_chat = ?, how_to_chat = ?, why_to_chat = ?,
correct_example = ?, wrong_example = ?, correct_explanation = ?,
wrong_explanation = ?, image_url = ?
WHERE day_number = ?");
$stmt->execute([
$_POST['title'], $_POST['what_to_chat'], $_POST['how_to_chat'], $_POST['why_to_chat'],
$_POST['correct_example'], $_POST['wrong_example'], $_POST['correct_explanation'],
$_POST['wrong_explanation'], $_POST['image_url'], $day
]);
$message = "{$day} 天的内容更新成功!";
$edit_day = 0;
}
// Fetch all steps
$steps = $pdo->query("SELECT * FROM steps ORDER BY day_number ASC")->fetchAll(PDO::FETCH_ASSOC);
// Fetch specific step for editing
$current_step = null;
if ($edit_day > 0) {
foreach ($steps as $s) {
if ($s['day_number'] == $edit_day) {
$current_step = $s;
break;
}
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>话术管理 - <?php echo htmlspecialchars($settings['site_title'] ?? '财神组聊天框架'); ?></title>
<link rel="icon" type="image/jpeg" href="<?php echo htmlspecialchars($site_logo); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<style>
:root { --admin-sidebar-width: 240px; }
body { background: #f8f9fa; }
.sidebar {
height: 100vh;
background: #212529;
color: #fff;
padding-top: 20px;
position: fixed;
width: var(--admin-sidebar-width);
z-index: 100;
}
.sidebar a { color: #adb5bd; text-decoration: none; padding: 12px 20px; display: block; transition: 0.2s; }
.sidebar a:hover, .sidebar a.active { background: #343a40; color: #fff; border-left: 4px solid #d4af37; }
.main-content {
margin-left: var(--admin-sidebar-width);
padding: 40px;
min-height: 100vh;
}
@media (max-width: 991px) {
.sidebar {
width: 100%;
height: auto;
position: fixed;
top: 0;
left: 0;
padding: 5px 0;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
justify-content: flex-start;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.main-content {
margin-left: 0;
padding: 80px 15px 20px 15px;
}
.sidebar a {
padding: 10px 15px;
white-space: nowrap;
font-size: 0.85rem;
border-left: none !important;
border-bottom: 3px solid transparent;
}
.sidebar a.active {
border-bottom: 3px solid #d4af37;
}
.sidebar hr, .sidebar .text-center { display: none !important; }
}
.card-header { font-weight: bold; }
</style>
</head>
<body>
<div class="sidebar">
<div class="text-center mb-4 px-3">
<?php if($site_logo): ?>
<img src="<?php echo htmlspecialchars($site_logo); ?>" alt="Logo" class="img-fluid mb-2" style="max-height: 60px; border-radius: 8px;">
<?php endif; ?>
<h5 class="text-warning">财神组管理</h5>
</div>
<a href="admin.php"><i class="bi bi-gear-fill me-2"></i> 系统设置</a>
<a href="admin_steps.php" class="active"><i class="bi bi-chat-dots-fill me-2"></i> 话术管理</a>
<a href="index.php" target="_blank"><i class="bi bi-eye me-2"></i> 查看前台</a>
<a href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> 退出登录</a>
</div>
<div class="main-content">
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3>话术管理</h3>
</div>
<?php if($message): ?>
<div class="alert alert-success"><?php echo $message; ?></div>
<?php endif; ?>
<?php if ($current_step): ?>
<div class="card shadow-sm mb-5">
<div class="card-header bg-dark text-white d-flex justify-content-between">
<span>正在编辑:第 <?php echo $current_step['day_number']; ?> 天</span>
<a href="admin_steps.php" class="text-white text-decoration-none"><i class="bi bi-x-lg"></i></a>
</div>
<div class="card-body p-4">
<form method="POST">
<input type="hidden" name="day_number" value="<?php echo $current_step['day_number']; ?>">
<div class="row g-3 mb-3">
<div class="col-md-6">
<label class="form-label fw-bold">步骤标题</label>
<input type="text" name="title" class="form-control" value="<?php echo htmlspecialchars($current_step['title']); ?>" required>
</div>
<div class="col-md-6">
<label class="form-label fw-bold">示例图片 URL</label>
<input type="text" name="image_url" class="form-control" value="<?php echo htmlspecialchars($current_step['image_url']); ?>" placeholder="https://...">
</div>
</div>
<div class="mb-3">
<label class="form-label fw-bold">聊什么 (What)</label>
<textarea name="what_to_chat" class="form-control" rows="3"><?php echo htmlspecialchars($current_step['what_to_chat']); ?></textarea>
</div>
<div class="mb-3">
<label class="form-label fw-bold">怎么去聊 (How)</label>
<textarea name="how_to_chat" class="form-control" rows="3"><?php echo htmlspecialchars($current_step['how_to_chat']); ?></textarea>
</div>
<div class="mb-3">
<label class="form-label fw-bold">为什么要这样聊 (Why)</label>
<textarea name="why_to_chat" class="form-control" rows="3"><?php echo htmlspecialchars($current_step['why_to_chat']); ?></textarea>
</div>
<div class="row g-3 mb-4">
<div class="col-md-6">
<div class="p-3 border rounded bg-light">
<label class="form-label text-success fw-bold">正确做法示例</label>
<textarea name="correct_example" class="form-control mb-2" rows="4"><?php echo htmlspecialchars($current_step['correct_example']); ?></textarea>
<label class="form-label small fw-bold">正确做法解释</label>
<textarea name="correct_explanation" class="form-control" rows="2"><?php echo htmlspecialchars($current_step['correct_explanation']); ?></textarea>
</div>
</div>
<div class="col-md-6">
<div class="p-3 border rounded bg-light">
<label class="form-label text-danger fw-bold">错误做法示例</label>
<textarea name="wrong_example" class="form-control mb-2" rows="4"><?php echo htmlspecialchars($current_step['wrong_example']); ?></textarea>
<label class="form-label small fw-bold">错误做法解释</label>
<textarea name="wrong_explanation" class="form-control" rows="2"><?php echo htmlspecialchars($current_step['wrong_explanation']); ?></textarea>
</div>
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" name="update_step" class="btn btn-warning px-5 fw-bold">更新内容</button>
<a href="admin_steps.php" class="btn btn-light px-4">取消</a>
</div>
</form>
</div>
</div>
<?php endif; ?>
<div class="table-responsive bg-white p-3 rounded shadow-sm">
<table class="table table-hover align-middle">
<thead class="table-light">
<tr>
<th width="80">天数</th>
<th>标题</th>
<th class="d-none d-md-table-cell">最后更新</th>
<th width="120">操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($steps as $s): ?>
<tr>
<td class="fw-bold">Day <?php echo $s['day_number']; ?></td>
<td><?php echo htmlspecialchars($s['title']); ?></td>
<td class="small text-muted d-none d-md-table-cell"><?php echo $s['updated_at']; ?></td>
<td>
<a href="admin_steps.php?edit=<?php echo $s['day_number']; ?>" class="btn btn-sm btn-outline-warning">
<i class="bi bi-pencil-square"></i> 编辑
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,352 +1,346 @@
:root {
--primary-color: #d4af37;
--secondary-color: #1a1a1a;
--text-color: #333;
--bg-color: #f8f9fa;
--sidebar-width: 280px;
--color-bg: #ffffff;
--color-text: #1a1a1a;
--color-primary: #2563EB; /* Vibrant Blue */
--color-secondary: #000000;
--color-accent: #A3E635; /* Lime Green */
--color-surface: #f8f9fa;
--font-heading: 'Space Grotesk', sans-serif;
--font-body: 'Inter', sans-serif;
--border-width: 2px;
--shadow-hard: 5px 5px 0px #000;
--shadow-hover: 8px 8px 0px #000;
--radius-pill: 50rem;
--radius-card: 1rem;
}
body {
font-family: 'Inter', "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-body);
background-color: var(--color-bg);
color: var(--color-text);
overflow-x: hidden;
}
/* Watermark */
.watermark-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 9999;
opacity: 0.04;
overflow: hidden;
h1, h2, h3, h4, h5, h6, .navbar-brand {
font-family: var(--font-heading);
letter-spacing: -0.03em;
}
.watermark-text {
position: absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
transform: rotate(-30deg);
font-size: 20px;
font-weight: bold;
/* Utilities */
.text-primary { color: var(--color-primary) !important; }
.bg-black { background-color: #000 !important; }
.text-white { color: #fff !important; }
.shadow-hard { box-shadow: var(--shadow-hard); }
.border-2-black { border: var(--border-width) solid #000; }
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
/* Navbar */
.navbar {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border-bottom: var(--border-width) solid transparent;
transition: all 0.3s;
padding-top: 1rem;
padding-bottom: 1rem;
}
.navbar.scrolled {
border-bottom-color: #000;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
.brand-text {
font-size: 1.5rem;
font-weight: 800;
}
.nav-link {
font-weight: 500;
color: var(--color-text);
margin-left: 1rem;
position: relative;
}
.nav-link:hover, .nav-link.active {
color: var(--color-primary);
}
/* Buttons */
.btn {
font-weight: 700;
font-family: var(--font-heading);
padding: 0.8rem 2rem;
border-radius: var(--radius-pill);
border: var(--border-width) solid #000;
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
box-shadow: var(--shadow-hard);
}
.btn:hover {
transform: translate(-2px, -2px);
box-shadow: var(--shadow-hover);
}
.btn:active {
transform: translate(2px, 2px);
box-shadow: 0 0 0 #000;
}
.btn-primary {
background-color: var(--color-primary);
border-color: #000;
color: #fff;
}
.btn-primary:hover {
background-color: #1d4ed8;
border-color: #000;
color: #fff;
}
.btn-outline-dark {
background-color: #fff;
color: #000;
}
.watermark-item {
padding: 80px;
white-space: nowrap;
.btn-cta {
background-color: var(--color-accent);
color: #000;
}
/* Sidebar Layout */
.wrapper {
display: flex;
.btn-cta:hover {
background-color: #8cc629;
color: #000;
}
/* Hero Section */
.hero-section {
min-height: 100vh;
padding-top: 80px;
}
#sidebar {
width: var(--sidebar-width);
background: var(--secondary-color);
color: #fff;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
position: fixed;
top: 0;
left: 0;
height: 100vh;
z-index: 1050;
box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}
#content {
width: 100%;
padding: 40px;
margin-left: var(--sidebar-width);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Sidebar toggled state (desktop) */
#sidebar.collapsed {
transform: translateX(-100%);
}
#content.expanded {
margin-left: 0;
}
.sidebar-header {
padding: 30px 25px;
background: #000;
text-align: center;
}
.sidebar-header h3 {
font-size: 1.1rem;
color: var(--primary-color);
margin: 0;
font-weight: 700;
letter-spacing: 1px;
}
#sidebar ul.components {
padding: 20px 0;
}
#sidebar ul li a {
padding: 15px 25px;
display: block;
color: #adb5bd;
text-decoration: none;
transition: 0.3s;
font-size: 0.95rem;
}
#sidebar ul li a:hover, #sidebar ul li.active > a {
color: #fff;
background: rgba(212, 175, 55, 0.15);
border-left: 4px solid var(--primary-color);
}
#sidebar ul li a i {
margin-right: 12px;
}
/* Mobile Nav Bar */
.mobile-nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 60px;
background: var(--secondary-color);
display: none;
align-items: center;
justify-content: space-between;
padding: 0 15px;
z-index: 1040;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.mobile-logo-text {
color: var(--primary-color);
font-weight: bold;
font-size: 1rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 200px;
}
#sidebarCollapseMobile {
font-size: 1.5rem;
}
/* Overlay */
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0,0,0,0.5);
z-index: 1045;
display: none;
backdrop-filter: blur(2px);
}
/* Floating TG Button */
.tg-float {
position: fixed;
right: 20px;
bottom: 90px;
z-index: 1001;
text-align: center;
}
.tg-btn {
width: 50px;
height: 50px;
background-color: #0088cc;
color: white;
.background-blob {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.6;
z-index: 1;
}
.blob-1 {
top: -10%;
right: -10%;
width: 600px;
height: 600px;
background: radial-gradient(circle, var(--color-accent), transparent);
}
.blob-2 {
bottom: 10%;
left: -10%;
width: 500px;
height: 500px;
background: radial-gradient(circle, var(--color-primary), transparent);
}
.highlight-text {
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
background-repeat: no-repeat;
background-size: 100% 40%;
background-position: 0 88%;
padding: 0 5px;
}
.dot { color: var(--color-primary); }
.badge-pill {
display: inline-block;
padding: 0.5rem 1rem;
border: 2px solid #000;
border-radius: 50px;
font-weight: 700;
background: #fff;
box-shadow: 4px 4px 0 #000;
font-family: var(--font-heading);
font-size: 0.9rem;
}
/* Marquee */
.marquee-container {
overflow: hidden;
white-space: nowrap;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}
.rotate-divider {
transform: rotate(-2deg) scale(1.05);
z-index: 10;
position: relative;
margin-top: -50px;
margin-bottom: 30px;
}
.marquee-content {
display: inline-block;
animation: marquee 20s linear infinite;
font-family: var(--font-heading);
font-weight: 700;
font-size: 1.5rem;
letter-spacing: 2px;
}
@keyframes marquee {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
/* Portfolio Cards */
.project-card {
border: 2px solid #000;
border-radius: var(--radius-card);
overflow: hidden;
background: #fff;
transition: transform 0.3s ease;
box-shadow: var(--shadow-hard);
height: 100%;
display: flex;
flex-direction: column;
}
.project-card:hover {
transform: translateY(-10px);
box-shadow: 8px 8px 0 #000;
}
.card-img-holder {
height: 250px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
text-decoration: none;
animation: pulse-tg 2s infinite;
border-bottom: 2px solid #000;
position: relative;
font-size: 4rem;
}
.tg-btn:hover {
.placeholder-art {
transition: transform 0.3s ease;
}
.project-card:hover .placeholder-art {
transform: scale(1.2) rotate(10deg);
}
.bg-soft-blue { background-color: #e0f2fe; }
.bg-soft-green { background-color: #dcfce7; }
.bg-soft-purple { background-color: #f3e8ff; }
.bg-soft-yellow { background-color: #fef9c3; }
.category-tag {
position: absolute;
top: 15px;
right: 15px;
background: #000;
color: #fff;
}
.tg-text {
display: block;
font-size: 10px;
margin-top: 5px;
background: rgba(0,0,0,0.7);
color: #fff;
padding: 2px 6px;
border-radius: 10px;
}
@keyframes pulse-tg {
0% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0.7); }
70% { box-shadow: 0 0 0 12px rgba(0, 136, 204, 0); }
100% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0); }
}
/* Back to Top */
#back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
display: none;
z-index: 1001;
width: 40px;
height: 40px;
}
/* Content Cards */
.content-card {
border: none;
border-radius: 15px;
box-shadow: 0 5px 20px rgba(0,0,0,0.05);
margin-bottom: 20px;
overflow: hidden;
}
.card-header {
background: #fff;
border-bottom: 1px solid #f0f0f0;
font-weight: 700;
padding: 15px 20px;
font-size: 1rem;
}
.card-body {
padding: 20px;
}
.text-content {
font-size: 1.05rem;
line-height: 1.7;
color: #444;
}
.step-badge {
background: var(--primary-color);
color: #fff;
padding: 4px 12px;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.75rem;
vertical-align: middle;
margin-left: 10px;
font-weight: 700;
}
/* Example Sections */
.example-box {
padding: 15px;
border-radius: 10px;
font-size: 0.95rem;
.card-body { padding: 1.5rem; }
.link-arrow {
text-decoration: none;
color: #000;
font-weight: 700;
display: inline-flex;
align-items: center;
margin-top: auto;
}
.correct-box {
background-color: #f1f8f1;
border-left: 5px solid #28a745;
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
.link-arrow:hover i { transform: translateX(5px); }
/* About */
.about-image-stack {
position: relative;
height: 400px;
width: 100%;
}
.wrong-box {
background-color: #fff5f5;
border-left: 5px solid #dc3545;
.stack-card {
position: absolute;
width: 80%;
height: 100%;
border-radius: var(--radius-card);
border: 2px solid #000;
box-shadow: var(--shadow-hard);
left: 10%;
transform: rotate(-3deg);
background-size: cover;
}
.explanation-box strong {
color: #666;
font-size: 0.85rem;
/* Forms */
.form-control {
border: 2px solid #000;
border-radius: 0.5rem;
padding: 1rem;
font-weight: 500;
background: #f8f9fa;
}
footer {
padding: 40px 0;
text-align: center;
border-top: 1px solid #eee;
margin-top: 30px;
.form-control:focus {
box-shadow: 4px 4px 0 var(--color-primary);
border-color: #000;
background: #fff;
}
/* Responsive Adjustments */
/* Animations */
.animate-up {
opacity: 0;
transform: translateY(30px);
animation: fadeUp 0.8s ease forwards;
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
@keyframes fadeUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* Social */
.social-links a {
transition: transform 0.2s;
display: inline-block;
}
.social-links a:hover {
transform: scale(1.2) rotate(10deg);
color: var(--color-accent) !important;
}
/* Responsive */
@media (max-width: 991px) {
#sidebar {
transform: translateX(-100%);
z-index: 2000;
}
#sidebar.active {
transform: translateX(0);
}
#content {
margin-left: 0;
padding: 85px 12px 20px 12px;
}
.mobile-nav {
display: flex;
.rotate-divider {
transform: rotate(0);
margin-top: 0;
margin-bottom: 2rem;
}
.section-title-container {
flex-direction: column;
align-items: flex-start !important;
margin-bottom: 20px !important;
.hero-section {
padding-top: 120px;
text-align: center;
min-height: auto;
padding-bottom: 100px;
}
.page-title {
font-size: 1.2rem !important;
font-weight: 800;
line-height: 1.4;
}
.display-1 { font-size: 3.5rem; }
.card-header {
padding: 10px 15px;
font-size: 0.85rem;
}
.card-body {
padding: 15px;
}
.text-content {
font-size: 0.9rem;
}
.watermark-item {
padding: 40px;
font-size: 16px;
}
.content-card {
border-radius: 10px;
margin-bottom: 15px;
}
/* Stack columns on mobile */
.row.g-3 > .col-md-6 {
flex: 0 0 100%;
max-width: 100%;
}
}
/* Desktop Hover Effects */
@media (min-width: 992px) {
.content-card {
transition: transform 0.2s;
}
.content-card:hover {
transform: translateY(-3px);
}
.blob-1 { width: 300px; height: 300px; right: -20%; }
.blob-2 { width: 300px; height: 300px; left: -20%; }
}

View File

@ -1,84 +1,73 @@
document.addEventListener('DOMContentLoaded', function () {
const sidebar = document.getElementById('sidebar');
const content = document.getElementById('content');
const sidebarCollapse = document.getElementById('sidebarCollapse');
const sidebarCollapseMobile = document.getElementById('sidebarCollapseMobile');
const overlay = document.getElementById('overlay');
const backToTop = document.getElementById('back-to-top');
document.addEventListener('DOMContentLoaded', () => {
// Sidebar Toggle for Mobile (Header button)
if (sidebarCollapseMobile) {
sidebarCollapseMobile.addEventListener('click', function () {
toggleMobileSidebar();
});
}
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
// Sidebar Toggle for Desktop (Content button)
if (sidebarCollapse) {
sidebarCollapse.addEventListener('click', function () {
if (window.innerWidth >= 992) {
sidebar.classList.toggle('collapsed');
content.classList.toggle('expanded');
// Change icon
const icon = sidebarCollapse.querySelector('i');
if (sidebar.classList.contains('collapsed')) {
icon.className = 'bi bi-text-indent-right';
} else {
icon.className = 'bi bi-text-indent-left';
const targetElement = document.querySelector(targetId);
if (targetElement) {
// Close mobile menu if open
const navbarToggler = document.querySelector('.navbar-toggler');
const navbarCollapse = document.querySelector('.navbar-collapse');
if (navbarCollapse.classList.contains('show')) {
navbarToggler.click();
}
} else {
toggleMobileSidebar();
// Scroll with offset
const offset = 80;
const elementPosition = targetElement.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - offset;
window.scrollTo({
top: offsetPosition,
behavior: "smooth"
});
}
});
}
});
function toggleMobileSidebar() {
sidebar.classList.toggle('active');
if (sidebar.classList.contains('active')) {
overlay.style.display = 'block';
document.body.style.overflow = 'hidden'; // Prevent scroll
// Navbar scroll effect
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white');
navbar.classList.remove('bg-transparent');
} else {
overlay.style.display = 'none';
document.body.style.overflow = 'auto';
}
}
// Close sidebar when clicking overlay
if (overlay) {
overlay.addEventListener('click', function () {
sidebar.classList.remove('active');
overlay.style.display = 'none';
document.body.style.overflow = 'auto';
});
}
// Back to Top functionality
window.addEventListener('scroll', function () {
if (window.scrollY > 300) {
backToTop.style.display = 'block';
} else {
backToTop.style.display = 'none';
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white');
navbar.classList.add('bg-transparent');
}
});
if (backToTop) {
backToTop.addEventListener('click', function () {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
// Intersection Observer for fade-up animations
const observerOptions = {
threshold: 0.1,
rootMargin: "0px 0px -50px 0px"
};
// Resize handler to clean up states
window.addEventListener('resize', function() {
if (window.innerWidth >= 992) {
sidebar.classList.remove('active');
if (overlay) overlay.style.display = 'none';
document.body.style.overflow = 'auto';
} else {
sidebar.classList.remove('collapsed');
content.classList.remove('expanded');
}
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-up');
entry.target.style.opacity = "1";
observer.unobserve(entry.target); // Only animate once
}
});
}, observerOptions);
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
// For now, let's just make sure the hero animations run.
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
// Given the request, the CSS animation I added runs on load for Hero.
// Let's make the project cards animate in.
const projectCards = document.querySelectorAll('.project-card');
projectCards.forEach((card, index) => {
card.style.opacity = "0";
card.style.animationDelay = `${index * 0.1}s`;
observer.observe(card);
});
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,68 +0,0 @@
<?php
// Initialize database tables
require_once __DIR__ . '/config.php';
try {
$pdo = db();
// Create users table
$pdo->exec("CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
// Create settings table
$pdo->exec("CREATE TABLE IF NOT EXISTS settings (
id INT AUTO_INCREMENT PRIMARY KEY,
setting_key VARCHAR(50) NOT NULL UNIQUE,
setting_value TEXT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)");
// Create steps table
$pdo->exec("CREATE TABLE IF NOT EXISTS steps (
id INT AUTO_INCREMENT PRIMARY KEY,
day_number INT NOT NULL UNIQUE,
title VARCHAR(255),
what_to_chat TEXT,
how_to_chat TEXT,
why_to_chat TEXT,
correct_example TEXT,
wrong_example TEXT,
correct_explanation TEXT,
wrong_explanation TEXT,
image_url VARCHAR(255),
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)");
// Seed default admin if not exists
$stmt = $pdo->prepare("SELECT COUNT(*) FROM users WHERE username = 'admin'");
$stmt->execute();
if ($stmt->fetchColumn() == 0) {
$password = password_hash('admin123', PASSWORD_DEFAULT);
$pdo->prepare("INSERT INTO users (username, password) VALUES ('admin', ?)")->execute([$password]);
}
// Seed default settings
$defaultSettings = [
'site_title' => '财神组聊天框架',
'site_logo' => 'assets/pasted-20260207-134833-7329dc42.jpg',
'tg_link' => 'https://t.me/zhangshihao818',
'footer_copy' => '© 2026 财神组聊天框架构造. 内部资料,翻版必究。',
'watermark_text' => '财神组专用字体'
];
foreach ($defaultSettings as $key => $val) {
$pdo->prepare("INSERT IGNORE INTO settings (setting_key, setting_value) VALUES (?, ?)")->execute([$key, $val]);
}
// Seed default steps 1-7
for ($i = 1; $i <= 7; $i++) {
$pdo->prepare("INSERT IGNORE INTO steps (day_number, title) VALUES (?, ?)")->execute([$i, "{$i}天:初步沟通"]);
}
} catch (PDOException $e) {
error_log("DB Init Error: " . $e->getMessage());
}

345
index.php
View File

@ -1,213 +1,150 @@
<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/db/init.php'; // Run init on first load
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$pdo = db();
// Get settings
$settings = [];
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$settings[$row['setting_key']] = $row['setting_value'];
}
$site_title = $settings['site_title'] ?? '财神组聊天框架';
$tg_link = $settings['tg_link'] ?? 'https://t.me/zhangshihao818';
$footer_copy = $settings['footer_copy'] ?? '© 2026 财神组聊天框架构造. 内部资料,翻版必究。';
$watermark_text = $settings['watermark_text'] ?? '财神组专用字体';
$site_logo = $settings['site_logo'] ?? 'assets/pasted-20260207-134833-7329dc42.jpg';
// Get current day from URL
$current_day = isset($_GET['day']) ? (int)$_GET['day'] : 1;
if ($current_day < 1 || $current_day > 7) $current_day = 1;
// Fetch step data
$stmt = $pdo->prepare("SELECT * FROM steps WHERE day_number = ?");
$stmt->execute([$current_day]);
$step = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$step) {
$step = [
'day_number' => $current_day,
'title' => "{$current_day}天:步骤加载中",
'what_to_chat' => '暂无内容',
'how_to_chat' => '暂无内容',
'why_to_chat' => '暂无内容',
'correct_example' => '暂无内容',
'wrong_example' => '暂无内容',
'correct_explanation' => '暂无内容',
'wrong_explanation' => '暂无内容',
'image_url' => ''
];
}
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!DOCTYPE html>
<html lang="zh-CN">
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($site_title); ?></title>
<link rel="icon" type="image/jpeg" href="<?php echo htmlspecialchars($site_logo); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head>
<body>
<!-- Watermark -->
<div class="watermark-container">
<div class="watermark-text">
<?php for($i=0; $i<100; $i++): ?>
<span class="watermark-item"><?php echo htmlspecialchars($watermark_text); ?></span>
<?php endfor; ?>
</div>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
<!-- Mobile Top Nav -->
<nav class="mobile-nav d-lg-none">
<button type="button" id="sidebarCollapseMobile" class="btn text-white">
<i class="bi bi-list"></i>
</button>
<div class="mobile-logo-text">
<?php echo htmlspecialchars($site_title); ?>
</div>
<div style="width: 40px;"></div> <!-- Spacer -->
</nav>
<!-- Floating TG -->
<div class="tg-float">
<a href="<?php echo htmlspecialchars($tg_link); ?>" target="_blank" class="tg-btn">
<i class="bi bi-telegram"></i>
</a>
<span class="tg-text">联系客服</span>
</div>
<!-- Back to Top -->
<button id="back-to-top" class="btn btn-warning rounded-circle shadow">
<i class="bi bi-arrow-up"></i>
</button>
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<div class="sidebar-header">
<?php if($site_logo): ?>
<img src="<?php echo htmlspecialchars($site_logo); ?>" alt="Logo" class="img-fluid mb-2" style="max-height: 80px; border-radius: 10px;">
<?php endif; ?>
<h3><?php echo htmlspecialchars($site_title); ?></h3>
</div>
<ul class="list-unstyled components">
<?php for($i=1; $i<=7; $i++): ?>
<li class="<?php echo $current_day == $i ? 'active' : ''; ?>">
<a href="index.php?day=<?php echo $i; ?>">
<i class="bi bi-calendar-check"></i> <?php echo $i; ?> 天:步骤
</a>
</li>
<?php endfor; ?>
<hr class="mx-3 opacity-25">
<li>
<a href="login.php"><i class="bi bi-shield-lock"></i> 管理后台</a>
</li>
</ul>
</nav>
<!-- Page Content -->
<div id="content">
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4 section-title-container">
<h2 class="page-title"><?php echo htmlspecialchars($step['title']); ?> <span class="step-badge">Day <?php echo $current_day; ?></span></h2>
<!-- Desktop sidebar collapse -->
<button type="button" id="sidebarCollapse" class="btn btn-outline-dark d-none d-lg-block">
<i class="bi bi-text-indent-left"></i>
</button>
</div>
<div class="row g-4">
<div class="col-lg-8">
<div class="card content-card">
<div class="card-header"><i class="bi bi-chat-quote-fill me-2 text-warning"></i> 聊什么 (Content)</div>
<div class="card-body">
<div class="text-content"><?php echo nl2br(htmlspecialchars($step['what_to_chat'] ?? '')); ?></div>
</div>
</div>
<div class="card content-card">
<div class="card-header"><i class="bi bi-info-circle-fill me-2 text-info"></i> 为什么要这样聊 (Reasoning)</div>
<div class="card-body">
<div class="text-content"><?php echo nl2br(htmlspecialchars($step['why_to_chat'] ?? '')); ?></div>
</div>
</div>
<div class="row g-3">
<div class="col-md-6">
<div class="card border-success content-card h-100">
<div class="card-header bg-success text-white"><i class="bi bi-check-circle-fill me-2"></i> 正确做法</div>
<div class="card-body">
<div class="example-box correct-box">
<strong>示例:</strong><br>
<div class="mt-2"><?php echo nl2br(htmlspecialchars($step['correct_example'] ?? '')); ?></div>
</div>
<div class="explanation-box mt-3">
<strong>解释:</strong><br>
<p class="mt-1 text-muted small"><?php echo nl2br(htmlspecialchars($step['correct_explanation'] ?? '')); ?></p>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card border-danger content-card h-100">
<div class="card-header bg-danger text-white"><i class="bi bi-x-circle-fill me-2"></i> 错误做法</div>
<div class="card-body">
<div class="example-box wrong-box">
<strong>示例:</strong><br>
<div class="mt-2"><?php echo nl2br(htmlspecialchars($step['wrong_example'] ?? '')); ?></div>
</div>
<div class="explanation-box mt-3">
<strong>解释:</strong><br>
<p class="mt-1 text-muted small"><?php echo nl2br(htmlspecialchars($step['wrong_explanation'] ?? '')); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card content-card">
<div class="card-header"><i class="bi bi-lightning-fill me-2 text-warning"></i> 怎么去聊 (Technique)</div>
<div class="card-body">
<div class="text-content"><?php echo nl2br(htmlspecialchars($step['how_to_chat'] ?? '')); ?></div>
</div>
</div>
<div class="card content-card">
<div class="card-header"><i class="bi bi-image me-2 text-primary"></i> 聊天示例图</div>
<div class="card-body text-center p-2">
<?php if(!empty($step['image_url'])): ?>
<img src="<?php echo htmlspecialchars($step['image_url']); ?>" class="img-fluid rounded shadow-sm" alt="Example" style="max-height: 500px;">
<?php else: ?>
<div class="py-5 bg-light text-muted rounded">
<i class="bi bi-image" style="font-size: 3rem;"></i><br>
示例图片后续上传
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<footer>
<p class="text-muted"><?php echo $footer_copy; ?></p>
</footer>
</div>
</div>
</div>
<!-- Sidebar Overlay for Mobile -->
<div id="overlay"></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>

View File

@ -1,73 +0,0 @@
<?php
session_start();
require_once __DIR__ . '/db/config.php';
$pdo = db();
$stmt = $pdo->query("SELECT setting_value FROM settings WHERE setting_key = 'site_logo'");
$site_logo = $stmt->fetchColumn() ?: 'assets/pasted-20260207-134833-7329dc42.jpg';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
if ($username === 'admin') {
$stmt = $pdo->prepare("SELECT password FROM users WHERE username = 'admin'");
$stmt->execute();
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['admin_logged_in'] = true;
header('Location: admin.php');
exit;
} else {
$error = '用户名或密码错误';
}
} 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="icon" type="image/jpeg" href="<?php echo htmlspecialchars($site_logo); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body { background-color: #f8f9fa; height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 400px; padding: 40px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); background: #fff; }
.btn-warning { background-color: #d4af37; border: none; color: #fff; }
.btn-warning:hover { background-color: #b8860b; color: #fff; }
.logo-img { max-height: 100px; margin-bottom: 20px; border-radius: 12px; }
</style>
</head>
<body>
<div class="login-card text-center">
<?php if($site_logo): ?>
<img src="<?php echo htmlspecialchars($site_logo); ?>" alt="Logo" class="logo-img">
<?php endif; ?>
<h3 class="mb-4">管理登录</h3>
<?php if($error): ?>
<div class="alert alert-danger text-start"><?php echo $error; ?></div>
<?php endif; ?>
<form method="POST" class="text-start">
<div class="mb-3">
<label class="form-label">用户名</label>
<input type="text" name="username" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label">密码</label>
<input type="password" name="password" class="form-control" required>
</div>
<button type="submit" class="btn btn-warning w-100 py-2 mt-2">登录</button>
</form>
<div class="text-center mt-3">
<a href="index.php" class="text-muted text-decoration-none small">返回首页</a>
</div>
</div>
</body>
</html>

View File

@ -1,5 +0,0 @@
<?php
session_start();
session_destroy();
header('Location: login.php');
exit;