sync from github

This commit is contained in:
mei 2024-10-19 21:33:47 +08:00
parent 02372d737d
commit 8447e6a77b
30 changed files with 3395 additions and 3 deletions

View File

@ -1,3 +0,0 @@
# ez-site
油二黑子站

81
apis/account.php Normal file
View File

@ -0,0 +1,81 @@
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['username'])) {
$username = trim($_POST['username']);
$password = $_POST['password'];
$contact = isset($_POST['contact']) ? trim($_POST['contact']) : null;
// 检查密码长度
if (strlen($password) < 5) {
$title = '密码太短至少需要5个字符';
$right_word = '注册';
$href_url = '/?page=account';
include('includes/time.php');
} else {
$password = password_hash($password, PASSWORD_DEFAULT);
// 检查用户名是否为空
if (empty($username)) {
$title = '用户名不能为空';
$right_word = '注册';
$href_url = '/?page=account';
include('includes/time.php');
} else {
// 检查用户名是否已存在
$checkStmt = $pdo->prepare("SELECT username FROM users WHERE username = ?");
$checkStmt->execute([$username]);
if ($checkStmt->rowCount() > 0) {
$title = '用户名已存在';
$right_word = '注册';
$href_url = '/?page=account';
include('includes/time.php');
} else {
$stmt = $pdo->prepare("INSERT INTO users (username, password, contact) VALUES (?, ?, ?)");
if ($stmt->execute([$username, $password, $contact])) {
$title = '注册成功';
$right_word = '登录';
$href_url = '/?page=account';
include('includes/time.php');
} else {
$title = '注册失败';
$right_word = '注册';
$href_url = '/?page=account';
include('includes/time.php');
}
}
}
}
}
// 登录
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login_username'])) {
$login_username = trim($_POST['login_username']);
$login_password = $_POST['login_password'];
// 检查登录用户名是否为空
if (empty($login_username)) {
$title = '用户名不能为空';
$right_word = '登录';
$href_url = '/?page=account';
include('includes/time.php');
} else {
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$login_username]);
$user = $stmt->fetch();
if ($user && password_verify($login_password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$title = '登录成功';
$right_word = '首';
$href_url = '/';
include('includes/time.php');
} else {
$title = '用户名或密码错误';
$right_word = '登录';
$href_url = '/?page=account';
include('includes/time.php');
}
}
}
?>

12
apis/load_comments.php Normal file
View File

@ -0,0 +1,12 @@
<?php
include 'db.php';
if (isset($_GET['love_wall_id'])) {
$love_wall_id = $_GET['love_wall_id'];
$stmt = $pdo->prepare("SELECT comments.content, users.username FROM comments JOIN users ON comments.user_id = users.id WHERE love_wall_id = ? ORDER BY comments.created_at DESC");
$stmt->execute([$love_wall_id]);
while ($row = $stmt->fetch()) {
echo "<div class='comment'><strong>{$row['username']}:</strong> {$row['content']}</div>";
}
}
?>

8
apis/load_love_wall.php Normal file
View File

@ -0,0 +1,8 @@
<?php
include 'db.php';
$stmt = $pdo->query("SELECT love_wall.content, users.username FROM love_wall JOIN users ON love_wall.user_id = users.id ORDER BY love_wall.created_at DESC");
while ($row = $stmt->fetch()) {
echo "<div class='love-message'><strong>{$row['username']}:</strong> {$row['content']}</div>";
}
?>

34
apis/onesay.php Normal file
View File

@ -0,0 +1,34 @@
<?php
// 定义一个关联数组,包含名言和它们的作者
$quotes = [
"这个年龄抽烟,不是装逼就是二逼" => "秦涛",
"天涯何处无芳草,何必要在身边找,本来数量就不多,质量还不咋地" => "秦涛",
"弱小和无知,不是生存的障碍,傲慢才是" => "《三体》",
"你的无畏来源于无知" => "《三体》",
"要想逃避现实,最好的方式就是深深介入现实之中" => "《三体》",
"我爱你,与你有何相干?毁灭你,又与你有何相干?" => "《三体》",
"宇宙很大,生活更大,也许以后还有缘相见" => "《三体》",
"大多数人到死都没有向尘世之外瞥一眼" => "《三体》",
"碑是那么小,与其说是为了纪念,更像是为了忘却" => "《三体》",
"人们习惯将凡事分出黑与白,但很遗憾,现实全是灰色的" => "《三体》",
"没有不散的宴席,一切都有个尽头" => "《三体》",
"编程本身虽然是一种智力活动,但是中国的现实却更像一种体力劳动" => "《未来世界的幸存者》",
"我们只是让某些局部变得更有秩序,把混乱转移到另一些领域。" => "《未来世界的幸存者》",
"苦难就是苦难,苦难不会带来成功" => "《活着》",
"我的职业建议是任何工作要么让你学习learn要么让你赚钱earn。如果既学不到新东西又赚不到钱你就应该走了" => "Garry Tan",
"编程既不是短跑,也不是马拉松,而是日记。在日复一日的累积当中,完成你的事业" => "《四十年编程感想》"
];
$randomKey = array_rand($quotes);
$quote = $randomKey;
$author = $quotes[$randomKey];
// 创建一个数组来存储名言和作者信息
$response = [
'quote' => $quote,
'author' => $author
];
// 将数组转换为 JSON 格式并输出
echo json_encode($response);

17
apis/submit_comment.php Normal file
View File

@ -0,0 +1,17 @@
<?php
if (isset($_SESSION['user_id']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
// 获取表单数据并清理
$content = htmlspecialchars($_POST['commentContent'], ENT_QUOTES, 'UTF-8');
$user_id = $_SESSION['user_id'];
if (isset($_POST['love_wall_id'])) {
$love_wall_id = intval($_POST['love_wall_id']);
$stmt = $pdo->prepare("INSERT INTO comments (user_id, content, love_wall_id) VALUES (?, ?, ?)");
$stmt->execute([$user_id, $content, $love_wall_id]);
} elseif (isset($_POST['article_id'])) {
$article_id = intval($_POST['article_id']);
$stmt = $pdo->prepare("INSERT INTO comments (user_id, content, article_id) VALUES (?, ?, ?)");
$stmt->execute([$user_id, $content, $article_id]);
}
}
?>

19
apis/submit_love.php Normal file
View File

@ -0,0 +1,19 @@
<?php
// 检查session中的user_id是否存在并且请求方法是POST
if (isset($_SESSION['user_id']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
// 获取表单数据并清理
$content = htmlspecialchars($_POST['content'], ENT_QUOTES, 'UTF-8');
$user_id = $_SESSION['user_id'];
// 准备SQL语句
$stmt = $pdo->prepare("INSERT INTO love_wall (user_id, content) VALUES (?, ?)");
// 执行SQL语句
if ($stmt->execute([$user_id, $content])) {
echo "发表成功!";
} else {
echo "发表失败!";
}
}
?>

213
assets/css/account.min.css vendored Normal file
View File

@ -0,0 +1,213 @@
:root {
/* COLORS */
--white: #e9e9e9;
--gray: #333;
--blue: #0367a6;
--lightblue: #008997;
/* RADII */
--button-radius: 0.7rem;
/* SIZES */
--max-width: 758px;
--max-height: 420px;
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
body {
align-items: center;
background-color: var(--white);
background: url("https://api.mmeiblog.cn/?api=pic&et=pc&time=true&source=true");
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
display: grid;
height: 100vh;
place-items: center;
}
.form__title {
font-weight: 300;
margin: 0;
margin-bottom: 1.25rem;
}
.link {
color: var(--gray);
font-size: 0.9rem;
margin: 1.5rem 0;
text-decoration: none;
}
.container {
background-color: var(--white);
border-radius: var(--button-radius);
box-shadow: 0 0.9rem 1.7rem rgba(0, 0, 0, 0.25),
0 0.7rem 0.7rem rgba(0, 0, 0, 0.22);
height: var(--max-height);
max-width: var(--max-width);
overflow: hidden;
position: relative;
width: 100%;
}
.container__form {
height: 100%;
position: absolute;
top: 0;
transition: all 0.6s ease-in-out;
}
.container--signin {
left: 0;
width: 50%;
z-index: 2;
}
.container.right-panel-active .container--signin {
transform: translateX(100%);
}
.container--signup {
left: 0;
opacity: 0;
width: 50%;
z-index: 1;
}
.container.right-panel-active .container--signup {
animation: show 0.6s;
opacity: 1;
transform: translateX(100%);
z-index: 5;
}
.container__overlay {
height: 100%;
left: 50%;
overflow: hidden;
position: absolute;
top: 0;
transition: transform 0.6s ease-in-out;
width: 50%;
z-index: 100;
}
.container.right-panel-active .container__overlay {
transform: translateX(-100%);
}
.overlay {
background-color: var(--lightblue);
background: url("https://api.mmeiblog.cn/?api=pic&et=pc&time=true&source=true");
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
height: 100%;
left: -100%;
position: relative;
transform: translateX(0);
transition: transform 0.6s ease-in-out;
width: 200%;
}
.container.right-panel-active .overlay {
transform: translateX(50%);
}
.overlay__panel {
align-items: center;
display: flex;
flex-direction: column;
height: 100%;
justify-content: center;
position: absolute;
text-align: center;
top: 0;
transform: translateX(0);
transition: transform 0.6s ease-in-out;
width: 50%;
}
.overlay--left {
transform: translateX(-20%);
}
.container.right-panel-active .overlay--left {
transform: translateX(0);
}
.overlay--right {
right: 0;
transform: translateX(0);
}
.container.right-panel-active .overlay--right {
transform: translateX(20%);
}
.btn {
background-color: var(--blue);
background-image: linear-gradient(90deg, var(--blue) 0%, var(--lightblue) 74%);
border-radius: 20px;
border: 1px solid var(--blue);
color: var(--white);
cursor: pointer;
font-size: 0.8rem;
font-weight: bold;
letter-spacing: 0.1rem;
padding: 0.9rem 4rem;
text-transform: uppercase;
transition: transform 80ms ease-in;
}
.form>.btn {
margin-top: 1.5rem;
}
.btn:active {
transform: scale(0.95);
}
.btn:focus {
outline: none;
}
.form {
background-color: var(--white);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 0 3rem;
height: 100%;
text-align: center;
}
.input {
background-color: #fff;
border: none;
padding: 0.9rem 0.9rem;
margin: 0.5rem 0;
width: 100%;
}
@keyframes show {
0%,
49.99% {
opacity: 0;
z-index: 1;
}
50%,
100% {
opacity: 1;
z-index: 5;
}
}

201
assets/css/all.min.css vendored Normal file
View File

@ -0,0 +1,201 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: url('/assets/img/bg.webp') no-repeat center center fixed;
background-size: cover;
color: #333;
}
nav {
background-color: #66ccff;
color: white;
padding: 15px;
position: sticky;
top: 0;
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
nav .logo {
color: #fff;
text-decoration: none;
font-size: 24px;
}
nav ul {
list-style-type: none;
padding: 0;
display: flex;
}
nav ul li {
margin-right: 20px;
}
nav ul li:last-child {
margin-right: 0;
}
nav a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
nav a:hover {
color: #ffcc00;
}
.icons {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: 20px 0;
}
.icon {
width: 200px;
margin: 10px;
text-align: center;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: transform 0.3s;
}
.icon a {
color: #007BFF;
text-decoration: none;
transition: color 0.3s;
}
.icon a:hover {
color: #ffcc00;
}
.icon p {
margin-top: 10px;
color: #777;
}
.icon:hover {
transform: scale(1.05);
}
.articles {
display: flex;
justify-content: space-between;
margin: 20px;
}
.left-column, .right-column {
width: 48%;
padding: 20px;
background-color: rgba(255, 255, 255, 0.9);
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.left-column > a, .right-column > a {
display: inline-block;
margin-bottom: 10px;
text-decoration: none;
color: #007BFF;
transition: color 0.3s;
}
.left-column > a:hover, .right-column > a:hover {
color: #ffcc00;
}
.left-column small, .right-column small {
display: block;
margin-top: 10px;
color: #777;
}
h2 {
text-align: center;
color: #333;
}
h3 {
color: #007BFF;
}
textarea {
width: 100%;
height: 100px;
border-radius: 5px;
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
button {
background-color: #007BFF;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
small {
display: block;
margin-top: 10px;
color: #777;
}
.comment-section {
margin-top: 20px;
padding: 10px;
border-top: 1px solid #ddd;
}
.page-footer {
background-color: #fff;
color: #66ccff;
text-align: center;
padding: 1em 0;
position: relative;
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.copyright {
margin: 0;
}
.commit-id {
margin: 0;
}
.commit-id span {
color: #aaa;
}

168
assets/css/article.min.css vendored Normal file
View File

@ -0,0 +1,168 @@
body {
font-family: 'Arial', sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
.container {
width: 80%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
nav {
background-color: #66ccff;
color: white;
padding: 15px;
position: sticky;
top: 0;
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
nav ul {
list-style-type: none;
padding: 0;
display: flex;
}
nav ul li {
margin-right: 20px;
}
nav ul li:last-child {
margin-right: 0;
}
nav a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
nav .logo {
color: #fff;
text-decoration: none;
font-size: 24px;
}
nav a:hover {
color: #ffcc00;
}
h2 {
text-align: center;
color: #333;
}
small {
color: #666;
}
hr {
border: 0;
height: 1px;
background: #ddd;
margin: 20px 0;
}
.comment {
border-bottom: 1px solid #e0e0e0;
padding: 15px;
margin-bottom: 15px;
background-color: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
.comment:hover {
transform: translateY(-5px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.comment strong {
color: #333;
display: block;
font-size: 1.1em;
margin-bottom: 5px;
}
.comment p {
color: #666;
font-size: 1em;
}
.comment:last-child {
margin-bottom: 0;
border-bottom: none;
}
/* 回复功能 还没写*/
.comment .sub-comment {
margin-left: 20px;
border-top: 1px solid #e0e0e0;
padding-top: 10px;
}
#comments h2 {
margin-top: 20px;
margin-bottom: 10px;
border-bottom: 1px solid #ddd;
padding-bottom: 5px;
font-size: 1.5em;
}
form textarea {
width: 100%;
height: 100px;
padding: 10px;
box-sizing: border-box;
margin-bottom: 10px;
}
form button {
padding: 10px 20px;
background: #333;
color: #fff;
border: none;
cursor: pointer;
}
form button:hover {
background: #555;
}
.page-footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 1em 0;
position: relative;
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.copyright {
margin: 0;
}
.commit-id {
margin: 0;
}
.commit-id span {
color: #aaa;
}

188
assets/css/love.min.css vendored Normal file
View File

@ -0,0 +1,188 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: url('/assets/img/bg.webp') no-repeat center center fixed;
background-size: cover;
color: #333;
}
nav {
background-color: #66ccff;
color: white;
padding: 15px;
position: sticky;
top: 0;
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
nav .logo {
color: #fff;
text-decoration: none;
font-size: 24px;
}
nav ul {
list-style-type: none;
padding: 0;
display: flex;
}
nav ul li {
margin-right: 20px;
}
nav ul li:last-child {
margin-right: 0;
}
nav a {
color: white;
text-decoration: none;
transition: color 0.3s;
}
nav a:hover {
color: #ffcc00;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.container h1 {
text-align: center;
margin-bottom: 20px;
color: #66ccff;
}
#loveForm {
margin-bottom: 20px;
background-color: rgba(255, 255, 255, 0.9);
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
padding: 20px;
}
#loveForm textarea {
width: 100%;
height: 100px;
border-radius: 5px;
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
resize: vertical;
}
#loveForm button[type="submit"] {
background-color: #007BFF;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
#loveForm button[type="submit"]:hover {
background-color: #0056b3;
}
#loveWall {
margin-top: 20px;
background-color: rgba(255, 255, 255, 0.9);
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
padding: 20px;
}
.love-message {
display: flex;
align-items: center;
padding: 10px;
border-bottom: 1px solid #ddd;
margin-bottom: 10px;
}
.love-message strong {
margin-right: 10px;
}
.comment-section {
margin-top: 20px;
padding: 10px;
border-top: 1px solid #ddd;
}
.comment {
display: flex;
align-items: center;
padding: 10px;
border-bottom: 1px solid #ddd;
margin-bottom: 10px;
}
.comment strong {
margin-right: 10px;
}
.commentForm {
margin-top: 10px;
}
.commentForm textarea {
width: 100%;
min-height: 50px;
border-radius: 5px;
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 10px;
resize: vertical;
}
.commentForm button[type="submit"] {
background-color: #007BFF;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
.commentForm button[type="submit"]:hover {
background-color: #0056b3;
}
.page-footer {
background-color: #fff;
color: #66ccff;
text-align: center;
padding: 1em 0;
position: relative;
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}
.copyright {
margin: 0;
}
.commit-id {
margin: 0;
}
.commit-id span {
color: #aaa;
}

BIN
assets/img/bg.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 KiB

BIN
assets/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

27
config.php Normal file
View File

@ -0,0 +1,27 @@
<?php
// 这配置暂时没啥用
$baseURL = 'https://ez.mei.lv/';
// 名称路由
$page_title = Array(
"home"=>"油二黑子站",
"account"=>"登录/注册 - 油二黑子站",
"admin"=>"管理界面 - 油二黑子站",
"love"=>"表白墙 - 油二黑子站"
);
// 文章路由
$article_type = Array(
"news"=>"新闻动态",
"activity"=>"活动一览"
);
// iconfont图标库的地址
$icon_font = '//at.alicdn.com/t/c/font_4536557_e64emmx4sxm.css';
// git commit id 要自己写
$git_commits = "18ebd2d112";
// umami统计的地址(其他的什么也行,可以不填)
$umami= '<script defer src="https://umami.mmeiblog.cn/script.js" data-website-id="28b0556f-bb41-480c-a531-e83f698b290f"></script>';
?>

1694
core/Parsedown.php Normal file

File diff suppressed because it is too large Load Diff

13
core/db.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$host = '1Panel-mysql-x'; // 数据库地址
$db = ''; // 数据库名
$user = ''; // 数据库用户名
$pass = ''; // 数据库密码
try {
$pdo = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
?>

12
core/safe/waf.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// 引入错误报告
error_reporting(E_ALL);
// 定义一个用于清理和验证输入的函数
function sanitizeInput($input) {
$input = trim($input);
$input = stripslashes($input);
$input = htmlspecialchars($input);
return $input;
}
?>

163
ez_site.sql Normal file
View File

@ -0,0 +1,163 @@
-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- 主机: 114.5.1.4
-- 生成日期: 2024-10-19 06:27:45
-- 服务器版本: 8.4.2
-- PHP 版本: 8.2.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- 数据库: `ez_site`
--
-- --------------------------------------------------------
--
-- 表的结构 `articles`
--
CREATE TABLE `articles` (
`id` int NOT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`type` enum('activity','news') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- 表的结构 `comments`
--
CREATE TABLE `comments` (
`id` int NOT NULL,
`user_id` int DEFAULT NULL,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`love_wall_id` int DEFAULT NULL,
`article_id` int DEFAULT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- 表的结构 `love_wall`
--
CREATE TABLE `love_wall` (
`id` int NOT NULL,
`user_id` int DEFAULT NULL,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- 表的结构 `users`
--
CREATE TABLE `users` (
`id` int NOT NULL,
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`group` enum('admin','user') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'user',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`phone_number` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- 转储表的索引
--
--
-- 表的索引 `articles`
--
ALTER TABLE `articles`
ADD PRIMARY KEY (`id`);
--
-- 表的索引 `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `love_wall_id` (`love_wall_id`),
ADD KEY `article_id` (`article_id`);
--
-- 表的索引 `love_wall`
--
ALTER TABLE `love_wall`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`);
--
-- 表的索引 `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username` (`username`);
--
-- 在导出的表使用AUTO_INCREMENT
--
--
-- 使用表AUTO_INCREMENT `articles`
--
ALTER TABLE `articles`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- 使用表AUTO_INCREMENT `comments`
--
ALTER TABLE `comments`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- 使用表AUTO_INCREMENT `love_wall`
--
ALTER TABLE `love_wall`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
--
-- 使用表AUTO_INCREMENT `users`
--
ALTER TABLE `users`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82;
--
-- 限制导出的表
--
--
-- 限制表 `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`love_wall_id`) REFERENCES `love_wall` (`id`),
ADD CONSTRAINT `comments_ibfk_3` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`);
--
-- 限制表 `love_wall`
--
ALTER TABLE `love_wall`
ADD CONSTRAINT `love_wall_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

39
import.sql Normal file
View File

@ -0,0 +1,39 @@
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
`email` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`group` ENUM('admin', 'user') DEFAULT 'user',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
contact VARCHAR(255) NULL
`phone_number` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL
);
CREATE TABLE love_wall (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);
CREATE TABLE articles (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
`type` ENUM('activity', 'news') NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE comments (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
content TEXT NOT NULL,
love_wall_id INT DEFAULT NULL,
article_id INT DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (love_wall_id) REFERENCES love_wall(id),
FOREIGN KEY (article_id) REFERENCES articles(id)
);

67
includes/account.php Normal file
View File

@ -0,0 +1,67 @@
<?php if (isset($_SESSION['user_id'])): ?>
<script>window.location.href = '/';</script>
<?php else: ?>
<div class="container right-panel-active">
<!-- Sign In -->
<div class="container__form container--signin">
<form method="POST" action="/?api=account" class="form" id="form1">
<h2 class="form__title">登录</h2>
<input type="text" placeholder="账号" class="input" name="login_username" id="login_username" require />
<input type="password" placeholder="密码" class="input" name="login_password" id="login_password" require />
<p><button type="submit" class="btn">登录</button></p>
<a href="?page=findpass" class="link">忘记密码?</a>
</form>
</div>
<!-- Sign Up -->
<div class="container__form container--signup">
<form method="POST" action="/?api=account" class="form" id="form2">
<input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response" />
<h2 class="form__title">注册</h2>
<input type="text" placeholder="账号" class="input" name="username" id="username" require />
<input type="password" placeholder="密码" class="input" name="password" id="password" require />
<input type="text" placeholder="留下任意联系方式以便于账号出现问题时联系您" class="input" name="contact" id="contact" require />
<button type="submit" class="btn">注册</button>
</form>
</div>
<!-- Overlay -->
<div class="container__overlay">
<div class="overlay">
<div class="overlay__panel overlay--left">
<p>已经有帐号了?</p>
<button class="btn" id="signIn">登录</button>
</div>
<div class="overlay__panel overlay--right">
<button class="btn" id="signUp">注册</button>
</div>
</div>
</div>
</div>
<script>
const signInBtn = document.getElementById("signIn");
const signUpBtn = document.getElementById("signUp");
const fistForm = document.getElementById("form1");
const secondForm = document.getElementById("form2");
const container = document.querySelector(".container");
signInBtn.addEventListener("click", () => {
container.classList.remove("right-panel-active");
});
signUpBtn.addEventListener("click", () => {
container.classList.add("right-panel-active");
});
fistForm.addEventListener("submit", (e) => {
});
secondForm.addEventListener("submit", (e) => {
});
</script>
<p class="copyright">&copy;
<?php echo date("Y") . ' mei&emsp;&emsp;&emsp;&emsp;<span class="iconfont icon-git-fenzhi-tianchong" style="font-size:15px"></span>' . $git_commits; ?>
</p>
</body>
<?php endif; ?>

46
includes/admin.php Normal file
View File

@ -0,0 +1,46 @@
<!-- TODO: Markdown write -->
<body>
<h1>后台管理 - 发布文章</h1>
<?php
// 检查用户是否登录且为管理员
if (!isset($_SESSION['user_id'])) {
echo "<p>请<a href='/?page=account'>登录</a>后访问此页面。</p>";
exit;
}
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
if ($user['group'] !== 'admin') {
echo "<p>您没有权限访问此页面。</p>";
exit;
}
// 发布文章逻辑
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$title = $_POST['title'];
$content = $_POST['content'];
$type = $_POST['type']; // 获取文章类型
$stmt = $pdo->prepare("INSERT INTO articles (title, content, type, created_at) VALUES (?, ?, ?, NOW())");
if ($stmt->execute([$title, $content, $type])) {
echo "<p>文章发布成功!</p>";
} else {
echo "<p>文章发布失败!</p>";
}
}
?>
<form method="POST" action="">
<input type="text" name="title" placeholder="文章标题" required>
<textarea name="content" placeholder="文章内容" required></textarea>
<select name="type" required>
<option value="activity">活动</option>
<option value="news">新闻</option>
</select>
<button type="submit">发布文章</button>
</form>
</body>
</html>

108
includes/article.php Normal file
View File

@ -0,0 +1,108 @@
<?php
$article_id = $_GET['id'];
$stmt = $pdo->prepare("SELECT * FROM articles WHERE id = ?");
$stmt->execute([$article_id]);
$article = $stmt->fetch();
?>
<!DOCTYPE html>
<html lang="zh">
<!-- TODO: Markdown渲染,文章美化 -->
<head>
<meta charset="UTF-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="theme-color" content="#2f4154">
<meta name="author" content="mei">
<meta name="keywords" content="油二黑子站,油田二中黑子站,东营市胜利第二中学,东营市油田二中,东营市胜利第二中学黑子站,东营市油田二中黑子站,二中,油田二中,林七二中">
<meta name="description" content="油二学生搭建的非官方综合服务及吐槽平台 - https:&#x2F;&#x2F;ez.mei.lv">
<meta property="og:type" content="website">
<meta property="og:title" content="<?php echo "{$article['title']} - 油田二中黑子站"; ?>">
<meta property="og:url" content="https://ez.mei.lv/index.php">
<meta property="og:site_name" content="油二黑子站">
<meta property="og:description" content="油二学生搭建的非官方综合服务及吐槽平台 - https:&#x2F;&#x2F;ez.mei.lv">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="mei">
<meta property="article:tag" content="油二黑子站,油田二中黑子站,东营市胜利第二中学,东营市油田二中,东营市胜利第二中学黑子站,东营市油田二中黑子站,二中,油田二中,林七二中">
<meta name="twitter:card" content="summary_large_image">
<title><?php echo "{$article['title']} - 油田二中黑子站"; ?></title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="/assets/css/article.min.css">
<link rel="stylesheet" href="<?php echo $icon_font;?>">
<?php echo $umami;?>
</head>
<body>
<nav>
<a href="/">
<strong class="logo">油二黑子站</strong>
</a>
<ul>
<li><a href="/?page=home">首页</a></li>
<li><a href="/?page=account">账户</a></li>
<li><a href="/?page=admin">管理</a></li>
<li><a href="/?page=love">表白墙</a></li>
</ul>
</nav>
<div class="container">
<?php
echo "<h2>{$article['title']}</h2>";
echo "<center><small>发布于: {$article['created_at']}</small></center>";
echo "<center><small>分类: {$article_type[$article['type']]}</small><hr></center>";
echo "<p>{$article['content']}</p>";
?>
<!-- TODO: 回复评论 -->
<h2 class="comment">评论区</h2>
<div id="comments">
<?php
$commentStmt = $pdo->prepare("SELECT comments.content, users.username FROM comments JOIN users ON comments.user_id = users.id WHERE article_id = ? ORDER BY comments.created_at DESC");
$commentStmt->execute([$article_id]);
while ($comment = $commentStmt->fetch()) {
echo "<div class='comment'><strong>{$comment['username']}:</strong> {$comment['content']}</div>";
}
?>
</div>
<?php if (isset($_SESSION['user_id'])): ?>
<form method="POST" id="commentForm" action="/?api=submit_comment">
<textarea name="commentContent" placeholder="发表评论..." required></textarea>
<button type="submit">评论</button>
</form>
<?php else: ?>
<p><a href="?page=account">登录</a>后发表评论。</p>
<?php endif; ?>
</div>
<script>
document.getElementById('commentForm').addEventListener('submit', function (event) {
event.preventDefault(); // 防止表单默认提交
var formData = new FormData(this);
formData.append('article_id', <?php echo $article_id; ?>); // 添加文章 ID
fetch('/?api=submit_comment', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
// 清空文本框
this.querySelector('textarea[name="commentContent"]').value = '';
// 暴力刷新
location.replace(location.href);
})
.catch(error => console.error('Error:', error));
});
function loadComments(articleId) {
fetch('/?api=load_comments.php?&article_id=' + articleId)
.then(response => response.text())
.then(data => {
document.getElementById('comments').innerHTML = data;
})
.catch(error => console.error('Error:', error));
}
</script>
</body>
</html>

21
includes/footer.php Normal file
View File

@ -0,0 +1,21 @@
<footer class="page-footer">
<div class="footer-content">
<p class="copyright">©2024 油二黑子站</p>
<div id="quoteDisplay"></div>
<p class="commit-id"><span class="iconfont icon-git-fenzhi-tianchong" style="font-size:15px"></span><?php echo $git_commits;?></p>
</div>
</footer>
<script>
document.addEventListener("DOMContentLoaded", function() {
fetch('/?api=onesay')
.then(response => response.json())
.then(data => {
const quoteDisplay = document.getElementById('quoteDisplay');
quoteDisplay.innerHTML = `<p><em>"${data.quote}"</em> —— <strong>${data.author}</strong></p>`;
})
.catch(error => console.error('Error fetching the quote:', error));
});
</script>
</body>
</html>

51
includes/header.php Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="theme-color" content="#2f4154">
<meta name="author" content="mei">
<meta name="keywords" content="油二黑子站,油田二中黑子站,东营市胜利第二中学,东营市油田二中,东营市胜利第二中学黑子站,东营市油田二中黑子站,二中,油田二中,林七二中">
<meta name="description" content="油二学生搭建的非官方综合服务及吐槽平台 - https:&#x2F;&#x2F;ez.mei.lv">
<meta property="og:type" content="website">
<meta property="og:title" content="<?php echo $page_title[$page] ?>">
<meta property="og:url" content="https://ez.mei.lv/index.php">
<meta property="og:site_name" content="油二黑子站">
<meta property="og:description" content="油二学生搭建的非官方综合服务及吐槽平台 - https:&#x2F;&#x2F;ez.mei.lv">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="mei">
<meta property="article:tag" content="油二黑子站,油田二中黑子站,东营市胜利第二中学,东营市油田二中,东营市胜利第二中学黑子站,东营市油田二中黑子站,二中,油田二中,林七二中">
<meta name="twitter:card" content="summary_large_image">
<title><?php echo $page_title[$page] ?></title>
<?php if ($page == 'account'): ?>
<link rel="stylesheet" type="text/css" href="/assets/css/account.min.css">
<?php elseif ($page == 'love'):?>
<link rel="stylesheet" type="text/css" href="/assets/css/love.min.css">
<?php else: ?>
<link rel="stylesheet" type="text/css" href="/assets/css/all.min.css">
<?php endif ?>
<script src="https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css">
<script>var messageOpts = { "progressBar": true, "showDuration": "1000", "hideDuration": "1000", "timeOut": "6000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut", "allowHtml": true, }; toastr.options = messageOpts;</script>
<link rel="stylesheet" href="<?php echo $icon_font;?>">
<?php echo $umami; ?>
</head>
<body>
<?php if ($page != 'account'): ?>
<nav>
<a href="/">
<strong class="logo">油二黑子站</strong>
</a>
<ul>
<li><a href="/home.html">首页</a></li>
<li><a href="/love.html">表白墙</a></li>
<li><a href="/admin.html">管理</a></li>
<li><a href="/account.html">账户</a></li>
</ul>
</nav>
<?php else: ?>
<?php endif; ?>

61
includes/home.php Normal file
View File

@ -0,0 +1,61 @@
<div class="icons">
<div class="icon">
<a>
<?php
function startCountdown($startDate, $firstPeriodDays, $secondPeriodDays, $extraHours)
{
$totalDays = $firstPeriodDays + $secondPeriodDays;
$currentTime = time();
$elapsedDays = floor(($currentTime - strtotime($startDate)) / (60 * 60 * 24));
$currentPeriod = $elapsedDays % $totalDays;
if ($currentPeriod < $firstPeriodDays) {
$remainingDays = $firstPeriodDays - $currentPeriod;
$remainingTime = $remainingDays * (60 * 60 * 24) + $extraHours * (60 * 60);
$days = floor($remainingTime / (60 * 60 * 24));
echo '<p>距离下一次大休还有</p><a style="font-size:30px;color:#66ccff;">' . $days . '</a><p>天</p>';
} else {
$remainingDays = $firstPeriodDays - $currentPeriod;
$remainingTime = $remainingDays * (60 * 60 * 24) + $extraHours * (60 * 60);
$days = floor($remainingTime / (60 * 60 * 24));
echo '<p>距离开学还有</p><a style="font-size:30px;color:red;">1</a><p>天</p>';
}
}
$startDate = '2024-10-06 16:25:00'; // 开始计时的日期
$firstPeriodDays = 12; // 第一阶段的天数
$secondPeriodDays = 2; // 第二阶段的天数
$extraHours = 0; // 额外的小时数
$countdownText = startCountdown($startDate, $firstPeriodDays, $secondPeriodDays, $extraHours);
?>
</div>
<div class="icon">
<p>今天油二</p>
<a style="font-size:30px;color:#66ccff;">没有爆炸</a>
</div>
<!-- TODO: 课程表下载(一课表) -->
</div>
<div class="articles">
<div class="left-column">
<h2>活动一览</h2>
<?php
$stmt = $pdo->query("SELECT * FROM articles WHERE type = 'activity' ORDER BY created_at DESC");
while ($row = $stmt->fetch()) {
echo "<a href='/article/{$row['id']}.html'><h3>{$row['title']}</h3></a>";
echo "<p>{$row['content']}</p>";
echo "<small>发布于: {$row['created_at']}</small><hr>";
}
?>
</div>
<div class="right-column">
<h2>新闻动态</h2>
<?php
$stmt = $pdo->query("SELECT * FROM articles WHERE type = 'news' ORDER BY created_at DESC");
while ($row = $stmt->fetch()) {
echo "<a href='/article/{$row['id']}.html'><h3>{$row['title']}</h3></a>";
echo "<p>{$row['content']}</p>";
echo "<small>发布于: {$row['created_at']}</small><hr>";
}
?>
</div>
</div>

83
includes/love.php Normal file
View File

@ -0,0 +1,83 @@
<div class="container">
<h1>表白墙</h1>
<?php if (isset($_SESSION['user_id'])): ?>
<form method="POST" id="loveForm" action="/?api=submit_love">
<div class="form-group">
<textarea name="content" placeholder="写点什么呢?" required></textarea>
</div>
<button type="submit">发表</button>
</form>
<?php else: ?>
<p><a href="/?page=account">登录</a>后发表内容。</p>
<?php endif; ?>
<h2>表白内容</h2>
<div id="loveWall">
<?php
$stmt = $pdo->prepare("SELECT love_wall.id, love_wall.content, users.username FROM love_wall JOIN users ON love_wall.user_id = users.id ORDER BY love_wall.created_at DESC");
$stmt->execute();
while ($row = $stmt->fetch()) {
echo "<div class='love-message'><strong>" . htmlspecialchars($row['username']) . ":</strong> " . htmlspecialchars($row['content']) . "</div>";
echo "<div class='comment-section' id='comments-{$row['id']}'>";
// 加载评论
$commentStmt = $pdo->prepare("SELECT comments.content, users.username FROM comments JOIN users ON comments.user_id = users.id WHERE love_wall_id = ? ORDER BY comments.created_at DESC");
$commentStmt->execute([$row['id']]);
while ($comment = $commentStmt->fetch()) {
echo "<div class='comment'><strong>" . htmlspecialchars($comment['username']) . ":</strong> " . htmlspecialchars($comment['content']) . "</div>";
}
echo "</div>";
if (isset($_SESSION['user_id'])) {
echo "<form method='POST' class='commentForm' data-love-wall-id='{$row['id']}'>";
echo "<textarea name='commentContent' placeholder='发表评论...' required></textarea>";
echo "<button type='submit'>评论</button>";
echo "</form>";
}
echo "<hr>";
}
?>
</div>
</div>
<script>
document.querySelectorAll('.commentForm').forEach(form => {
form.addEventListener('submit', function(event) {
event.preventDefault();
var formData = new FormData(this);
formData.append('love_wall_id', this.dataset.loveWallId);
fetch('/?api=submit_comment', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
this.querySelector('textarea[name="commentContent"]').value = '';
loadComments(this.dataset.loveWallId);
alert('评论成功!');
})
.catch(error => {
console.error('Error:', error);
alert('评论失败,请稍后再试!');
});
});
});
function loadComments(loveWallId) {
fetch('/?api=load_comments&love_wall_id=' + loveWallId)
.then(response => response.text())
.then(data => {
document.getElementById('comments-' + loveWallId).innerHTML = data;
})
.catch(error => {
console.error('Error:', error);
alert('加载评论失败,请稍后再试!');
});
}
</script>
</body>
</html>

31
includes/time.php Normal file
View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>2 Seconds Countdown Redirect</title>
<style>
body { text-align: center; }
h1 { font-size: 3em; }
</style>
</head>
<body>
<h1><?php echo $title ?>!,将在 <a id="countdown">2</a> 秒后跳转至<?php echo $right_word ?>页</h1>
<script>
var seconds = 2;
function updateCountdown() {
var countdownElement = document.getElementById('countdown');
countdownElement.textContent = seconds;
seconds--;
if (seconds >= 0) {
setTimeout(updateCountdown, 1000);
} else {
var url = "<?php echo $href_url;?>";
window.location.href = url;
}
}
updateCountdown();
</script>
</body>
</html>

33
index.php Normal file
View File

@ -0,0 +1,33 @@
<?php
include('config.php');
include 'core/db.php';
session_start();
include('core/safe/waf.php');
// 获取参数
$page = isset($_GET['page']) ? sanitizeInput($_GET['page']) : '';
$api = isset($_GET['api']) ? sanitizeInput($_GET['api']) : '';
if (empty($page) and empty($api)) {
$page = 'home';
include('includes/header.php');
include('includes/home.php');
include('includes/footer.php');
}
elseif ($page == 'article') {
include('includes/article.php');
}
elseif ($page == 'account') {
include('includes/header.php');
include('includes/account.php');
}
elseif (empty($page) and !empty($api)) {
include('apis/' . $api . '.php');
}
else {
include('includes/header.php');
include('includes/' . $page . '.php');
include('includes/footer.php');
}
?>

5
rewrite.conf Normal file
View File

@ -0,0 +1,5 @@
rewrite ^/article/([^.]+)\.html$ /?page=article&id=$1 last;
rewrite ^/love\.html$ /?page=love last;
rewrite ^/account\.html$ /?page=account last;
rewrite ^/home\.html$ /?page=home last;
rewrite ^/admin\.html$ /?page=admin last;