This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.php
executable file
·87 lines (77 loc) · 2.27 KB
/
manage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/*
Sepocatch Virtual ICP version 5
Manage page.
*/
include './src/DataManager.php';
$dm = new DataManager();
$dm->setDataPath("./services/data/data.json");
$logged_in = false;
session_start();
// 检测登录 //
if(isset($_SESSION['sepocatch_icp_username'])) {
$logged_in = true;
$sepocatch_icp_username = $_SESSION['sepocatch_icp_username'];
}
else {
header("Location: ./login.php");
exit();
}
// 结束检测 //
// 查看页面 //
if (isset($_GET['action'])) {
$action = $_GET['action'];
$avaliable_actions = ["index", "list", "modify", "add", "delete", "delete-confirm", "systemctl"];
if (!in_array($action, $avaliable_actions)) {
$action = "index";
}
}
else {
$action = "index";
}
if ($action == "modify") {
if (!isset($_GET["id"])) {
header("Location: ./manage.php?action=list");
exit();
}
$record = $dm->getRecords($_GET["id"]) [0];
if ($record ["Creator"] != $sepocatch_icp_username && $sepocatch_icp_username != "DKoTechnology") {
header("Location: ./manage.php?action=list");
}
$data = $dm->getRecords($_GET["id"]);
$name = $data[0]["Name"];
$domain = $data[0]["Domain"];
$description = $data[0]["Description"];
$number = $_GET["id"];
}
if ($action == "delete") {
if (!isset($_GET["domain"])) {
header("Location: ./manage.php?action=list");
}
$domain = $_GET["domain"];
$record = $dm->getRecords($_GET["domain"]) [0];
if ($record ["Creator"] != $sepocatch_icp_username && $sepocatch_icp_username != "DKoTechnology") {
header("Location: ./manage.php?action=list");
}
}
if ($action == "delete-confirm") {
if (!isset($_GET["domain"])) {
header("Location: ./manage.php?action=list");
}
if ($record ["Creator"] != $sepocatch_icp_username && $sepocatch_icp_username != "DKoTechnology") {
header("Location: ./manage.php?action=list");
}
$domain = $_GET["domain"];
$dm->removeRecord($domain);
header("Location: ./manage.php?action=list&tips=1");
}
$tips_hidden = "hidden";
if (isset($_GET["tips"])) {
$tips = $_GET["tips"];
$tips_hidden = "";
}
// 结束检测 //
$title = "管理后台";
include './src/front/header.html';
include './src/front/manage/'. $action .'.html';
include './src/front/footer.html';