-
Notifications
You must be signed in to change notification settings - Fork 1
/
bans.php
executable file
·64 lines (60 loc) · 2.1 KB
/
bans.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
<?php
require_once './include/page.php';
$page = new Page("bans");
if($page->hasPermission("bans", "EDIT")) {
if(isset($_POST["id"])) {
$uuid = $_POST['id'];
$st = $page->conn->prepare("SELECT * FROM negativity_bans_active WHERE id = ?");
$st->execute(array($uuid));
$rows = $st->fetchAll(PDO::FETCH_ASSOC);
if(count($rows) >= 1) { // found line to log, should be not more than one
$row = $rows[0];
$logBan = $page->conn->prepare("INSERT INTO negativity_bans_log (id, reason, banned_by, expiration_time, cheat_name, revoked, execution_time, revocation_time, ip) VALUES (?,?,?,?,?,?,?,CURRENT_TIMESTAMP,?);");
$logBan->execute(array($uuid, $row["reason"], $row["banned_by"], $row["expiration_time"], $row["cheat_name"], 1, $row["execution_time"], $row["ip"]));
$logBan->closeCursor();
// now delete from actual db
$unban = $page->conn->prepare("DELETE FROM negativity_bans_active WHERE id = ?");
$unban->execute(array($uuid));
$unban->closeCursor();
}
$st->closeCursor();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $page->print_common_head(); ?>
</head>
<body>
<?php
$page->show_topbar();
?>
<div class="page-wrapper">
<?php
$page->show_header();
?>
<div class="content-wrapper">
<div class="container">
<table>
<?php
$rows = $page->run_query();
if(count($rows) == 0) {
$page->print_no_row();
} else {
foreach ($rows as $row) {
$player_name = $page->get_name($row["id"]);
if ($player_name === null)
continue;
$page->print_row($row);
}
$page->show_page_mover();
}
?>
</table>
</div>
<?php $page->show_footer(); ?>
</div>
</div>
</body>
</html>