Auto commit: 2026-01-30T15:26:15.260Z
This commit is contained in:
parent
ae0b28e858
commit
b0e98f8349
123
admin.php
Normal file
123
admin.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
|
||||
// Simple password protection
|
||||
define('ADMIN_PASSWORD', '888888'); // You can change this
|
||||
session_start();
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
session_destroy();
|
||||
header("Location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['password'])) {
|
||||
if ($_POST['password'] === ADMIN_PASSWORD) {
|
||||
$_SESSION['admin_logged_in'] = true;
|
||||
} else {
|
||||
$error = "密码错误";
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['admin_logged_in'])) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>后台登录 - 财神组</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body { background: #B71C1C; display: flex; align-items: center; justify-content: center; height: 100vh; font-family: 'Inter', sans-serif; }
|
||||
.login-card { background: #fff; padding: 2rem; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); width: 100%; max-width: 400px; }
|
||||
.btn-primary { background: #D4AF37; border: none; }
|
||||
.btn-primary:hover { background: #B8860B; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<h3 class="text-center mb-4" style="color: #B71C1C;">财神组内部管理</h3>
|
||||
<?php if (isset($error)) echo "<div class='alert alert-danger'>$error</div>"; ?>
|
||||
<form method="POST">
|
||||
<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-primary w-100">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = db();
|
||||
|
||||
// Save content
|
||||
if (isset($_POST['save'])) {
|
||||
$id = $_POST['id'];
|
||||
$title = $_POST['title'];
|
||||
$content = $_POST['content'];
|
||||
|
||||
$stmt = $db->prepare("UPDATE site_content SET title = :title, content = :content WHERE id = :id");
|
||||
$stmt->execute(['title' => $title, 'content' => $content, 'id' => $id]);
|
||||
$success = "内容更新成功!";
|
||||
}
|
||||
|
||||
$contents = $db->query("SELECT * FROM site_content ORDER BY id ASC")->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>内容管理后台 - 财神组</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
:root { --primary-red: #B71C1C; --gold: #D4AF37; }
|
||||
body { background: #f8f9fa; }
|
||||
.navbar { background: var(--primary-red); }
|
||||
.card-header { background: var(--gold); color: white; font-weight: bold; }
|
||||
.btn-gold { background: var(--gold); color: white; border: none; }
|
||||
.btn-gold:hover { background: #B8860B; color: white; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-dark mb-4">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">财神组内容管理系统</a>
|
||||
<a href="?logout=1" class="btn btn-outline-light btn-sm">退出登录</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mb-5">
|
||||
<?php if (isset($success)) echo "<div class='alert alert-success'>$success</div>"; ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<?php foreach ($contents as $c): ?>
|
||||
<div class="card mb-4 shadow-sm">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span><?php echo htmlspecialchars($c['title']); ?> (<?php echo $c['section_key']; ?>)</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST">
|
||||
<input type="hidden" name="id" value="<?php echo $c['id']; ?>">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">页面标题</label>
|
||||
<input type="text" name="title" class="form-control" value="<?php echo htmlspecialchars($c['title']); ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">页面内容 (支持 HTML)</label>
|
||||
<textarea name="content" class="form-control" rows="10"><?php echo htmlspecialchars($c['content']); ?></textarea>
|
||||
</div>
|
||||
<button type="submit" name="save" class="btn btn-gold">保存修改</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -22,7 +22,7 @@ body {
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
opacity: 0.05;
|
||||
opacity: 0.04;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
@ -30,52 +30,78 @@ body {
|
||||
}
|
||||
|
||||
.watermark-text {
|
||||
font-size: 3rem;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 900;
|
||||
transform: rotate(-30deg);
|
||||
color: var(--primary-red);
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
margin: 50px;
|
||||
margin: 40px;
|
||||
}
|
||||
|
||||
/* Sidebar Styling */
|
||||
#sidebar {
|
||||
height: 100vh;
|
||||
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
padding: 0;
|
||||
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
|
||||
background-color: var(--sidebar-bg) !important;
|
||||
border-right: 2px solid var(--primary-red);
|
||||
z-index: 100;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
#sidebar .nav-link {
|
||||
.sidebar-sticky {
|
||||
height: calc(100vh - 48px);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#sidebarMenu .nav-link {
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
margin: 5px 15px;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#sidebar .nav-link:hover {
|
||||
#sidebarMenu .nav-link:hover {
|
||||
background-color: #fce4e4;
|
||||
color: var(--primary-red);
|
||||
transform: translateX(5px);
|
||||
}
|
||||
|
||||
#sidebar .nav-link.active {
|
||||
#sidebarMenu .nav-link.active {
|
||||
background-color: var(--primary-red);
|
||||
color: var(--accent-gold) !important;
|
||||
box-shadow: 0 4px 6px rgba(183, 28, 28, 0.3);
|
||||
}
|
||||
|
||||
.sidebar-heading {
|
||||
font-size: 0.8rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 800;
|
||||
color: var(--primary-red) !important;
|
||||
letter-spacing: 0.15rem;
|
||||
letter-spacing: 0.1rem;
|
||||
padding: 0 2rem;
|
||||
margin-top: 2rem !important;
|
||||
margin-top: 1.5rem !important;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Navbar */
|
||||
.navbar-brand {
|
||||
padding-top: .75rem;
|
||||
padding-bottom: .75rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.navbar-toggler {
|
||||
top: .25rem;
|
||||
right: 1rem;
|
||||
}
|
||||
|
||||
/* Content Area */
|
||||
@ -84,7 +110,7 @@ main {
|
||||
}
|
||||
|
||||
#content-area {
|
||||
min-height: 85vh;
|
||||
min-height: 80vh;
|
||||
line-height: 1.8;
|
||||
background: white;
|
||||
padding: 2.5rem !important;
|
||||
@ -115,20 +141,13 @@ main {
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn-primary {
|
||||
background-color: #0088cc !important;
|
||||
border: none;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--primary-red) !important;
|
||||
border: none;
|
||||
/* Image styling in content */
|
||||
#content-area img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin: 1rem 0;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
@ -141,9 +160,26 @@ main {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 767.98px) {
|
||||
.sidebar {
|
||||
top: 48px;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
.sidebar.show {
|
||||
transform: translateX(0);
|
||||
width: 100%;
|
||||
max-width: 280px;
|
||||
}
|
||||
#content-area {
|
||||
padding: 1.5rem !important;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
width: 6px;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
@ -152,16 +188,6 @@ main {
|
||||
background: var(--primary-red);
|
||||
border-radius: 10px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #880000;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 767.98px) {
|
||||
#sidebar {
|
||||
height: auto;
|
||||
border-right: none;
|
||||
border-bottom: 2px solid var(--primary-red);
|
||||
}
|
||||
}
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
||||
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
|
||||
@ -1,8 +1,18 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const siteData = JSON.parse(document.getElementById('site-data').textContent);
|
||||
const siteDataElement = document.getElementById('site-data');
|
||||
if (!siteDataElement) return;
|
||||
|
||||
let siteData = [];
|
||||
try {
|
||||
siteData = JSON.parse(siteDataElement.textContent);
|
||||
} catch (e) {
|
||||
console.error("Failed to parse site data", e);
|
||||
}
|
||||
|
||||
const contentArea = document.getElementById('content-area');
|
||||
const navLinks = document.querySelectorAll('.nav-link');
|
||||
const backToTopBtn = document.getElementById('backToTop');
|
||||
const sidebarMenu = document.getElementById('sidebarMenu');
|
||||
|
||||
// Handle Content Switching
|
||||
navLinks.forEach(link => {
|
||||
@ -18,9 +28,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
if (data) {
|
||||
renderContent(data);
|
||||
// On mobile, scroll to content after selection
|
||||
|
||||
// On mobile, scroll to content after selection and close sidebar
|
||||
if (window.innerWidth < 768) {
|
||||
contentArea.scrollIntoView({ behavior: 'smooth' });
|
||||
// Close bootstrap collapse if open
|
||||
const bsCollapse = bootstrap.Collapse.getInstance(sidebarMenu);
|
||||
if (bsCollapse) {
|
||||
bsCollapse.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -56,9 +72,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
|
||||
// Auto-select Day 1 on load
|
||||
// Auto-select Day 1 on load if available
|
||||
const firstLink = document.querySelector('.nav-link[data-section="day1"]');
|
||||
if (firstLink) {
|
||||
if (firstLink && siteData.length > 0) {
|
||||
firstLink.click();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
91
index.php
91
index.php
@ -5,12 +5,15 @@ $projectName = "财神组聊天构造";
|
||||
$projectDesc = "财神组内部资料 翻版必究";
|
||||
$projectLogo = "assets/pasted-20260130-145435-442da57a.jpg";
|
||||
|
||||
$dbError = false;
|
||||
$allContent = [];
|
||||
|
||||
try {
|
||||
$db = db();
|
||||
$stmt = $db->query("SELECT section_key, title, content FROM site_content ORDER BY id ASC");
|
||||
$allContent = $stmt->fetchAll();
|
||||
} catch (PDOException $e) {
|
||||
$allContent = [];
|
||||
$dbError = "数据库连接失败或未初始化。请检查 db/config.php 并访问 /db/setup_db.php";
|
||||
error_log("DB Error: " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
@ -36,17 +39,28 @@ try {
|
||||
|
||||
<!-- Watermark -->
|
||||
<div class="watermark">
|
||||
<?php for($i=0; $i<20; $i++): ?>
|
||||
<?php for($i=0; $i<40; $i++): ?>
|
||||
<div class="watermark-text">财神组</div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
|
||||
<!-- Mobile Navbar -->
|
||||
<header class="navbar sticky-top bg-danger flex-md-nowrap p-0 shadow d-md-none">
|
||||
<a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6 text-white fw-bold" href="#">
|
||||
<img src="<?php echo htmlspecialchars($projectLogo); ?>" alt="Logo" style="height: 30px; margin-right: 10px; border-radius: 4px;">
|
||||
<?php echo htmlspecialchars($projectName); ?>
|
||||
</a>
|
||||
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation" style="right: 1rem; top: .5rem;">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Sidebar -->
|
||||
<nav id="sidebar" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
|
||||
<div class="position-sticky pt-3">
|
||||
<div class="text-center mb-4 px-3">
|
||||
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
|
||||
<div class="position-sticky pt-3 sidebar-sticky">
|
||||
<div class="text-center mb-4 px-3 d-none d-md-block">
|
||||
<img src="<?php echo htmlspecialchars($projectLogo); ?>" alt="Logo" class="img-fluid rounded shadow" style="max-height: 100px; border: 2px solid #FFD700;">
|
||||
<h5 class="mt-3 fw-black text-danger"><?php echo htmlspecialchars($projectName); ?></h5>
|
||||
</div>
|
||||
@ -55,41 +69,64 @@ try {
|
||||
<span><i class="bi bi-journal-text me-2"></i>每日脚本</span>
|
||||
</h6>
|
||||
<ul class="nav flex-column">
|
||||
<?php foreach ($allContent as $item):
|
||||
if (strpos($item['section_key'], 'day') === 0): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-section="<?php echo $item['section_key']; ?>">
|
||||
<i class="bi bi-calendar-check me-2"></i>
|
||||
<?php echo htmlspecialchars($item['title']); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; endforeach; ?>
|
||||
<?php if (empty($allContent)): ?>
|
||||
<li class="nav-item px-3 text-muted small">暂无内容</li>
|
||||
<?php else: ?>
|
||||
<?php foreach ($allContent as $item):
|
||||
if (strpos($item['section_key'], 'day') === 0): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-section="<?php echo $item['section_key']; ?>">
|
||||
<i class="bi bi-calendar-check me-2"></i>
|
||||
<?php echo htmlspecialchars($item['title']); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-2 text-muted text-uppercase">
|
||||
<span><i class="bi bi-list-stars me-2"></i>引导步骤</span>
|
||||
</h6>
|
||||
<ul class="nav flex-column mb-5">
|
||||
<?php foreach ($allContent as $item):
|
||||
if (strpos($item['section_key'], 'step') === 0): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-section="<?php echo $item['section_key']; ?>">
|
||||
<i class="bi bi-pin-angle me-2"></i>
|
||||
<?php echo htmlspecialchars($item['title']); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; endforeach; ?>
|
||||
<?php if (empty($allContent)): ?>
|
||||
<li class="nav-item px-3 text-muted small">暂无内容</li>
|
||||
<?php else: ?>
|
||||
<?php foreach ($allContent as $item):
|
||||
if (strpos($item['section_key'], 'step') === 0): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-section="<?php echo $item['section_key']; ?>">
|
||||
<i class="bi bi-pin-angle me-2"></i>
|
||||
<?php echo htmlspecialchars($item['title']); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4 py-4">
|
||||
<?php if ($dbError): ?>
|
||||
<div class="alert alert-danger shadow-sm border-start border-5 border-danger">
|
||||
<h4 class="alert-heading"><i class="bi bi-exclamation-triangle-fill me-2"></i>系统未就绪</h4>
|
||||
<p><?php echo $dbError; ?></p>
|
||||
<hr>
|
||||
<p class="mb-0 small">请确保您已经在宝塔面板中:1. 创建了数据库;2. 修改了 <code>db/config.php</code>;3. 访问了 <code>您的域名/db/setup_db.php</code>。</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="content-area" class="bg-white p-5 rounded shadow-sm">
|
||||
<div class="text-center py-5">
|
||||
<img src="<?php echo htmlspecialchars($projectLogo); ?>" alt="Welcome" class="img-fluid mb-4 opacity-75" style="max-width: 200px; filter: grayscale(1) brightness(0.5) sepia(1) hue-rotate(-50deg) saturate(5);">
|
||||
<h2 class="fw-bold" style="color: #B71C1C;">欢迎使用财神组内部系统</h2>
|
||||
<p class="lead text-muted">请从左侧菜单选择对应的脚本或步骤开始学习</p>
|
||||
<?php if (empty($allContent) && !$dbError): ?>
|
||||
<div class="mt-4 p-3 border rounded bg-light">
|
||||
<p class="text-danger fw-bold mb-0">发现数据库中没有内容!</p>
|
||||
<a href="db/setup_db.php" class="btn btn-danger mt-2">点击此处初始化数据</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -104,12 +141,12 @@ try {
|
||||
</div>
|
||||
|
||||
<!-- Telegram Floating Button -->
|
||||
<a href="https://t.me/zhangshihao818" target="_blank" class="btn btn-primary rounded-circle shadow-lg position-fixed" style="bottom: 80px; right: 30px; width: 65px; height: 65px; display: flex; align-items: center; justify-content: center; z-index: 10000; background-color: #0088cc; border: 3px solid #fff;">
|
||||
<i class="bi bi-telegram fs-1 text-white"></i>
|
||||
<a href="https://t.me/zhangshihao818" target="_blank" class="btn btn-primary rounded-circle shadow-lg position-fixed" style="bottom: 80px; right: 30px; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; z-index: 10000; background-color: #0088cc; border: 3px solid #fff;">
|
||||
<i class="bi bi-telegram fs-2 text-white"></i>
|
||||
</a>
|
||||
|
||||
<!-- Back to Top Button -->
|
||||
<button id="backToTop" class="btn btn-danger rounded-circle shadow-lg position-fixed d-none" style="bottom: 30px; right: 30px; width: 45px; height: 45px; z-index: 10000; border: 2px solid #FFD700;">
|
||||
<button id="backToTop" class="btn btn-danger rounded-circle shadow-lg position-fixed d-none" style="bottom: 25px; right: 25px; width: 45px; height: 45px; z-index: 10000; border: 2px solid #FFD700;">
|
||||
<i class="bi bi-arrow-up fs-5"></i>
|
||||
</button>
|
||||
|
||||
@ -124,4 +161,4 @@ try {
|
||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user