-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathadmin.php
283 lines (283 loc) · 9.15 KB
/
admin.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?php
if(!file_exists("mysql.php")){
header("Location: setup/index.php");
exit;
}
session_start();
require("datamanager.php");
require('assets/languages/lang_'.getSetting("lang").'.php');
if(!isset($_SESSION["username"])){
?>
<meta http-equiv="refresh" content="0; URL=login.php">
<?php
exit;
} else if(getAccountRank($_SESSION["username"]) < 2){
?>
<meta http-equiv="refresh" content="0; URL=mytickets.php">
<?php
exit;
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Admin</title>
<link rel="stylesheet" href="assets/css/main.css">
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
</head>
<body>
<div class="flex">
<div class="flex-item">
<?php
if(isset($_GET["delcat"])){
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM categorys WHERE ID = :id");
$stmt->bindParam(":id", $_GET["delcat"], PDO::PARAM_INT);
$stmt->execute();
$count = $stmt->rowCount();
if($count != 0){
$stmt = $mysql->prepare("UPDATE categorys SET STATUS = 1 WHERE ID = :id");
$stmt->bindParam(":id", $_GET["delcat"], PDO::PARAM_INT);
$stmt->execute();
?>
<div class="success">
<?php echo CAT_DEL; ?>
</div>
<?php
} else {
?>
<div class="error">
<?php echo ERROR; ?>
</div>
<?php
}
}
?>
<h1><?php echo CATEGORYS; ?></h1>
<div class="icon-card">
<a href="addcategory.php"><i class="fas fa-plus-square fa-2x"></i></a>
</div>
<?php
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM categorys WHERE STATUS = 0");
$stmt->execute();
$count = $stmt->rowCount();
if($count != 0){
?>
<table>
<tr>
<th>Name</th>
<th><?php echo ACTION; ?></th>
</tr>
<?php
while ($row = $stmt->fetch()) {
?>
<tr>
<td><?php echo $row["NAME"]; ?></td>
<td><a href="admin.php?delcat=<?php echo $row["ID"]; ?>" class="btn"><i class="far fa-trash-alt"></i></a></td>
</tr>
<?php
}
}
?>
</table>
</div>
<div class="flex-item">
<?php
if(isset($_GET["delfaq"])){
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM faq WHERE ID = :id");
$stmt->bindParam(":id", $_GET["delfaq"], PDO::PARAM_INT);
$stmt->execute();
$count = $stmt->rowCount();
if($count != 0){
$stmt = $mysql->prepare("DELETE FROM faq WHERE ID = :id");
$stmt->bindParam(":id", $_GET["delfaq"], PDO::PARAM_INT);
$stmt->execute();
?>
<div class="success">
<?php echo FAQ_DEL; ?>
</div>
<?php
} else {
?>
<div class="error">
<?php echo ERROR; ?>
</div>
<?php
}
}
?>
<h1>FAQ</h1>
<div class="icon-card">
<a href="addfaq.php"><i class="fas fa-plus-square fa-2x"></i></a>
</div>
<?php
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM faq");
$stmt->execute();
$count = $stmt->rowCount();
if($count != 0){
?>
<table>
<tr>
<th><?php echo QUESTION; ?></th>
<th><?php echo ANSWER; ?></th>
<th><?php echo ACTION; ?></th>
</tr>
<?php
while ($row = $stmt->fetch()) {
?>
<tr>
<td><?php echo $row["QUESTION"]; ?></td>
<td><?php echo $row["ANSWER"]; ?></td>
<td><a href="admin.php?delfaq=<?php echo $row["ID"]; ?>" class="btn"><i class="far fa-trash-alt"></i></a></td>
</tr>
<?php
}
} else {
?>
<div class="error">
<?php echo NOFAQ; ?>
</div>
<?php
}
?>
</table>
</div>
<div class="flex-item sidebar">
<?php require('assets/inc/sidebar.inc.php'); ?>
</div>
</div>
<div class="flex">
<div class="flex-item">
<h1>Accounts</h1>
<?php
require("mysql.php");
$stmt = $mysql->prepare("SELECT * FROM accounts");
$stmt->execute();
$count = $stmt->rowCount();
if($count != 0){
?>
<table>
<tr>
<th>ID</th>
<th><?php echo USERNAME; ?></th>
<th>Email</th>
<th><?php echo RANK; ?></th>
<th><?php echo ACTION; ?></th>
</tr>
<?php
while ($row = $stmt->fetch()) {
?>
<tr>
<td><?php echo $row["ID"]; ?></td>
<td><?php echo $row["USERNAME"]; ?></td>
<td><?php echo $row["EMAIL"]; ?></td>
<td><?php
if(getAccountRank($row["USERNAME"]) == 3 || getAccountRank($row["USERNAME"]) == 2){
echo "Admin";
} else if(getAccountRank($row["USERNAME"]) == 2){
echo "Team";
} else if(getAccountRank($row["USERNAME"]) == 1){
echo MEMBER;
}
?></td>
<td><a href="editaccount.php?user=<?php echo $row["USERNAME"]; ?>" class="btn"><i class="far fa-edit"></i></a></td>
</tr>
<?php
}
}
?>
</table>
</div>
<div class="flex-item">
<?php
migrate();
if(isset($_POST["submit"])){
setSetting("lang", $_POST["lang"]);
setSetting("captcha", $_POST["captcha"]);
setSetting("captcha_public", $_POST["captcha-public"]);
setSetting("captcha_private", $_POST["captcha-secret"]);
setSetting("mc_register", $_POST["mcregister"]);
?>
<div class="success">
<?php echo SAVED; ?>
</div>
<?php
}
?>
<h1><?php echo SETTINGS; ?></h1>
<h3><?php echo LANGUAGE; ?></h3>
<form action="admin.php" method="post">
<select name="lang">
<?php
if(getSetting("lang") == "en"){
?>
<option value="en">English</option>
<option value="de">German (Deutsch)</option>
<option value="cn">Chinese (中文)</option>
<?php
} else if(getSetting("lang") == "cn"){
?>
<option value="cn">Chinese (中文)</option>
<option value="en">English</option>
<option value="de">German (Deutsch)</option>
<?php
} else {
?>
<option value="de">German (Deutsch)</option>
<option value="en">English</option>
<option value="cn">Chinese (中文)</option>
<?php
}
?>
</select>
<h3><?php echo MC_REGISTER; ?></h3>
<p><?php echo MC_REGISTER_DESC; ?></p>
<select name="mcregister">
<?php
if(getSetting("mc_register") == "0"){
?>
<option value="0"><?php echo DISABLED; ?></option>
<option value="1"><?php echo ENABLED; ?></option>
<?php
} else {
?>
<option value="1"><?php echo ENABLED; ?></option>
<option value="0"><?php echo DISABLED; ?></option>
<?php
}
?>
</select>
<h3>Captcha</h3>
<select name="captcha">
<?php
if(getSetting("captcha") == "0"){
?>
<option value="0"><?php echo DISABLED; ?></option>
<option value="1"><?php echo ENABLED; ?></option>
<?php
} else {
?>
<option value="1"><?php echo ENABLED; ?></option>
<option value="0"><?php echo DISABLED; ?></option>
<?php
}
?>
</select>
<?php
$publickey = getSetting("captcha_public");
$privatekey = getSetting("captcha_private");
?>
<p><?php echo CAPTCHA_HINT; ?></p>
<input type="text" name="captcha-public" placeholder="<?php echo CAPTCHA_PUBLIC_KEY ?>" value="<?php echo $publickey; ?>"><br>
<input type="text" name="captcha-secret" placeholder="<?php echo CAPTCHA_PRIVATE_KEY; ?>" value="<?php echo $privatekey; ?>"><br>
<button type="submit" name="submit"><?php echo SAVE; ?></button>
</form>
</div>
</div>
</body>
</html>