diff --git a/index.php b/index.php index 39ad64b..2f0c6a3 100644 --- a/index.php +++ b/index.php @@ -1,2183 +1,2130 @@ - ['name' => '全部音乐', 'color' => '#b89e81', 'text_color' => '#5d4037'], - 'cantonese' => ['name' => '粤语歌曲', 'color' => '#c8e6c9', 'text_color' => '#2e7d32'], - 'mandarin' => ['name' => '国语歌曲', 'color' => '#fff3e0', 'text_color' => '#e65100'], - 'waiyu' => ['name' => '外语歌曲', 'color' => '#e3f2fd', 'text_color' => '#0d47a1'], - 'classic' => ['name' => '经典老歌', 'color' => '#efebe9', 'text_color' => '#3e2723'], - 'other' => ['name' => '其他音乐', 'color' => '#f3e5f5', 'text_color' => '#6a1b9a'] -]; - -// 模拟音乐列表数据(实际项目中可从数据库获取) -$musicList = require_once __DIR__ . '/data/music.php'; - -// 获取当前页面URL -function getCurrentPageURL() { - $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; - $host = $_SERVER['HTTP_HOST']; - $script = $_SERVER['SCRIPT_NAME']; - return $protocol . $host . $script; -} -$currentPageUrl = getCurrentPageURL(); -?> - - - - - - <?php echo htmlspecialchars($pageTitle); ?> - - - - - - - -
- - - - - - -
- -
-

音乐分享

-
- - - - - 上传音乐 - - - - -
- -
- - 个人设置 - -
-
- - - - - 登录 - - - - 注册 - - -
-
-
- -
- -
- - -
-
- -
-
- - -
-

音乐分类

-
- $category): ?> - - -
- - -
- - -
-
- - -
-

其他链接

- - LeonAPP - - - bilibili - - - 爱发电支持 - -
- -
-

最新公告

-

作者:JGZ_YES

-
- connect_error) { - die("

数据库连接失败: " . htmlspecialchars($conn_gg->connect_error, ENT_QUOTES, 'UTF-8') . "

"); - } - - // 关键:设置连接字符集为utf8mb4(必须在查询前执行) - if (!$conn_gg->set_charset("utf8mb4")) { - die("

字符集设置失败: " . htmlspecialchars($conn_gg->error, ENT_QUOTES, 'UTF-8') . "

"); - } - - // 查询最新公告(带错误处理) - $sql = "SELECT nr, time FROM announcements ORDER BY id DESC LIMIT 1"; - $result = $conn_gg->query($sql); - - if ($result === FALSE) { - // 错误信息仍需转义,避免恶意代码 - echo "

查询错误: " . htmlspecialchars($conn_gg->error, ENT_QUOTES, 'UTF-8') . "

"; - } elseif ($result->num_rows > 0) { - $row = $result->fetch_assoc(); - // 1. 保留nl2br():将数据库中的\n换行符转为HTML的
标签 - // 2. 移除htmlspecialchars():让HTML标签(如)正常解析 - echo "

" . nl2br($row["nr"]) . "

"; - // 发布时间仍需转义(纯文本,避免注入) - echo "

发布时间: " . htmlspecialchars($row["time"], ENT_QUOTES, 'UTF-8') . "

"; - } else { - echo "

暂无公告

"; - } - $conn_gg->close(); - ?> -
- - - 查看历史公告 - -
- - -
- - -
- - - - - -

-

作者:

- -
-
- - -
-
-
-
-
-
- 0:00 - / - -
-
- - -
-
- - -
- -
- -
-

下载: - 点我下载 -

-
- - - -
- -
-
-
-
- - -
- 链接已复制到剪贴板! -
- - -
- -
- - -
-
版本:
-
©
-
歌曲资源如有侵权联系383260290@qq.com删除
-
- - - - - \ No newline at end of file + ['name' => '全部音乐', 'color' => '#b89e81', 'text_color' => '#5d4037'], + 'cantonese' => ['name' => '粤语歌曲', 'color' => '#c8e6c9', 'text_color' => '#2e7d32'], + 'mandarin' => ['name' => '国语歌曲', 'color' => '#fff3e0', 'text_color' => '#e65100'], + 'waiyu' => ['name' => '外语歌曲', 'color' => '#e3f2fd', 'text_color' => '#0d47a1'], + 'classic' => ['name' => '经典老歌', 'color' => '#efebe9', 'text_color' => '#3e2723'], + 'other' => ['name' => '其他音乐', 'color' => '#f3e5f5', 'text_color' => '#6a1b9a'] +]; + +// 模拟音乐列表数据(实际项目中可从数据库获取) +$musicList = require_once __DIR__ . '/data/music.php'; + +// 获取当前页面URL +function getCurrentPageURL() { + $protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; + $host = $_SERVER['HTTP_HOST']; + $script = $_SERVER['SCRIPT_NAME']; + return $protocol . $host . $script; +} +$currentPageUrl = getCurrentPageURL(); +?> + + + + + + <?php echo htmlspecialchars($pageTitle); ?> + + + + + + + +
+ + + + + + +
+ +
+

音乐分享

+
+ + + + + 上传音乐 + + + + +
+ +
+ + 个人设置 + +
+
+ + + + + 登录 + + + + 注册 + + +
+
+
+ +
+ +
+ + +
+
+ +
+
+ + +
+

音乐分类

+
+ $category): ?> + + +
+ + +
+ + +
+
+ + + + +
+

最新公告

+

作者:JGZ_YES

+
+ connect_error) { + die("

数据库连接失败: " . htmlspecialchars($conn_gg->connect_error, ENT_QUOTES, 'UTF-8') . "

"); + } + + // 关键:设置连接字符集为utf8mb4(必须在查询前执行) + if (!$conn_gg->set_charset("utf8mb4")) { + die("

字符集设置失败: " . htmlspecialchars($conn_gg->error, ENT_QUOTES, 'UTF-8') . "

"); + } + + // 查询最新公告(带错误处理) + $sql = "SELECT nr, time FROM announcements ORDER BY id DESC LIMIT 1"; + $result = $conn_gg->query($sql); + + if ($result === FALSE) { + // 错误信息仍需转义,避免恶意代码 + echo "

查询错误: " . htmlspecialchars($conn_gg->error, ENT_QUOTES, 'UTF-8') . "

"; + } elseif ($result->num_rows > 0) { + $row = $result->fetch_assoc(); + // 1. 保留nl2br():将数据库中的\n换行符转为HTML的
标签 + // 2. 移除htmlspecialchars():让HTML标签(如)正常解析 + echo "

" . nl2br($row["nr"]) . "

"; + // 发布时间仍需转义(纯文本,避免注入) + echo "

发布时间: " . htmlspecialchars($row["time"], ENT_QUOTES, 'UTF-8') . "

"; + } else { + echo "

暂无公告

"; + } + $conn_gg->close(); + ?> +
+ + + 查看历史公告 + +
+ + +
+ + +
+ + + + + +

+

作者:

+ +
+
+ + +
+
+
+
+
+
+ 0:00 + / + +
+
+ + +
+
+ + +
+ +
+ +
+

下载: + 点我下载 +

+
+ + + +
+ +
+
+
+
+ + +
+ 链接已复制到剪贴板! +
+ + +
+ +
+ + +
+
版本:
+
©
+
歌曲资源如有侵权联系383260290@qq.com删除
+
+ + + +