commit 432ffb8e5bcd330a0c116fd95bb15bb54e3121b5 Author: MKStoler Date: Wed Jan 29 22:30:31 2025 +0800 init: 初始化仓库 diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..e52e474 --- /dev/null +++ b/.htaccess @@ -0,0 +1,3 @@ + + Deny from all + \ No newline at end of file diff --git a/admin/delete.php b/admin/delete.php new file mode 100644 index 0000000..08335e5 --- /dev/null +++ b/admin/delete.php @@ -0,0 +1,16 @@ + diff --git a/admin/edit.php b/admin/edit.php new file mode 100644 index 0000000..889159e --- /dev/null +++ b/admin/edit.php @@ -0,0 +1,166 @@ + '', 'message' => '', 'examInfos' => []]; + +// 保存逻辑 +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $id = preg_replace('/[^a-zA-Z0-9]/', '', $_POST['id']); + + $newConfig = [ + 'examName' => $_POST['examName'], + 'message' => $_POST['message'], + 'room' => ' ', + 'examInfos' => [] + ]; + + foreach ($_POST['subject'] as $index => $subject) { + $newConfig['examInfos'][] = [ + 'name' => $subject, + 'start' => $_POST['start'][$index], + 'end' => $_POST['end'][$index] + ]; + } + + file_put_contents("../configs/{$id}.json", json_encode($newConfig, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); + header('Location: index.php'); + exit; +} + +// 加载现有配置 +if (!empty($id) && file_exists("../configs/{$id}.json")) { + $config = json_decode(file_get_contents("../configs/{$id}.json"), true); +} +?> + + + + 编辑配置 + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+ +

考试科目安排

+
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+ +
+ +
+
+ + \ No newline at end of file diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..0b3819f --- /dev/null +++ b/admin/index.php @@ -0,0 +1,139 @@ + $id, + 'mtime' => date("Y-m-d H:i:s", filemtime("../configs/$file")), + 'size' => filesize("../configs/$file") + ]; + } +} + +// 按创建时间排序 +uksort($configs, function($a, $b) { + return filemtime("../configs/$b.json") - filemtime("../configs/$a.json"); +}); +?> + + + + 配置管理后台 + + + +
+

考试配置管理 当前用户:

+ 退出登录 +
+ +
+ 新建配置 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
配置ID最后修改时间文件大小操作
暂无配置文件
KB + 编辑 + 删除 + 预览 +
+ + + + \ No newline at end of file diff --git a/admin/login.php b/admin/login.php new file mode 100644 index 0000000..827e0a4 --- /dev/null +++ b/admin/login.php @@ -0,0 +1,104 @@ + + + + + 登录 + + + +
+

登录

+ +
+ +
+
+ + +
+
+ + +
+ +
+
+ + \ No newline at end of file diff --git a/configs/111111.json b/configs/111111.json new file mode 100644 index 0000000..2c4d770 --- /dev/null +++ b/configs/111111.json @@ -0,0 +1,12 @@ +{ + "examName": "1111", + "message": "1111", + "room": " ", + "examInfos": [ + { + "name": "1111", + "start": "2025-01-29T00:00", + "end": "2025-01-29T22:15" + } + ] +} \ No newline at end of file diff --git a/get_config.php b/get_config.php new file mode 100644 index 0000000..ab65948 --- /dev/null +++ b/get_config.php @@ -0,0 +1,18 @@ + '缺少ID参数'])); +} + +$id = preg_replace('/[^a-zA-Z0-9]/', '', $_GET['id']); +$file = "configs/{$id}.json"; + +if (!file_exists($file)) { + http_response_code(404); + die(json_encode(['error' => '配置不存在'])); +} + +echo file_get_contents($file); +?> \ No newline at end of file diff --git a/includes/auth.php b/includes/auth.php new file mode 100644 index 0000000..6a893a9 --- /dev/null +++ b/includes/auth.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/includes/users.json b/includes/users.json new file mode 100644 index 0000000..7456dd4 --- /dev/null +++ b/includes/users.json @@ -0,0 +1,4 @@ +[{ + "username": "admin", + "password": "21232f297a57a5a743894a0e4a801fc3" +}] \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..a7d26e3 --- /dev/null +++ b/index.php @@ -0,0 +1,129 @@ + + + + + 考试看板配置查询 + + + +
+

考试看板配置查询

+
+ + + +
+ +
+ +
+

管理员请前往 管理后台

+
+ + + + \ No newline at end of file