Original commit

-----------2025.6.27  skimrme
This commit is contained in:
skimrme
2025-06-27 16:16:53 +08:00
commit 6719c4fbe8
17 changed files with 405 additions and 0 deletions

81
public/bbs/index.php Executable file
View File

@@ -0,0 +1,81 @@
<!-- bbs首页 -->
<html>
<head>
<meta charset="utf-8" lang="zh-CN">
<link rel="stylesheet" type="text/css" href="../css/body/body_index.css">
<link rel="stylesheet" type="text/css" href="../css/body/style.css">
<link rel="stylesheet" type="text/css" href="../css/body/a_url_none.css">
<link rel="stylesheet" type="text/css" href="../css/body/footer.css">
</head>
<body>
<!-- 页面内容区 -->
<div id="div_top">
<?php
//include './navbar/header_li.html';
?>
</div>
<div id="div_content">
<?php
include '../navbar/h1_center_green.html';
?>
<!-- sqlite 数据库连接 -->
<div id="div_1">
<?php
//include '../navbar/header_li.html';
?>
</div>
<div id="div_top_navbar_li">
<?php
include "../navbar/div_top_navbar_li.html";
?>
</div>
<div id="div_centent_2">
<?php
$dbPath = '../db/green-dam.db'; // 数据库文件路径
try {
// 创建SQLite3对象以连接到数据库
$sqlite = new SQLite3($dbPath);
echo "<br>";
// 执行查询
$result = $sqlite->query('SELECT * FROM bbs_anonymous');
// 检查查询是否成功
if (!$result) {
die('查询失败: ' . $sqlite->lastErrorMsg());
}
echo "今日匿名";
echo '<br>';
echo '<br>';
// 遍历结果集并输出
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
// 假设表中有id, name, email字段这里根据您的实际字段进行修改
echo 'id: ' . htmlspecialchars($row['id']) . '<br>';
echo 'name: ' . htmlspecialchars($row['name']) . '<br>';
echo 'content: ' . htmlspecialchars($row['content']) . '<br>';
echo 'time: ' . htmlspecialchars($row['time']) . '<br><br>';
}
// 关闭数据库连接(虽然在脚本结束时连接通常会自动关闭)
$sqlite->close();
} catch (Exception $e) {
// 捕获异常并输出错误信息
echo "连接失败: " . $e->getMessage();
}
?>
</div>
</div>
<!-- 图床来源 https://www.dmoe.cc/ -->
<div id="div_under">
<b>图片来源</b><a href="https://www.dmoe.cc/" style="text-decoration-line: none;">樱花二次元图片API</a>
</div>
<!-- 图床区 body背景 -->
<body id="body_img">
</body>
</body>
<?php
include '../navbar/footer.html';
?>
</html>