-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipbans.php
113 lines (101 loc) · 2.46 KB
/
ipbans.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
<?php
// AcmlmBoard XD - IP ban management tool
// Access: administrators only
include("lib/common.php");
$title = __("IP bans");
AssertForbidden("editIPBans");
if($loguser['powerlevel'] < 3)
Kill(__("Only administrators get to manage IP bans."));
MakeCrumbs(array(__("Main")=>"./", __("IP ban manager")=>""), "");
if($_POST['action'] == __("Add"))
{
$qIPBan = "insert into ipbans (ip, reason, date) values ('".justEscape($_POST['ip'])."', '".justEscape($_POST['reason'])."', ".((int)$_POST['days'] > 0 ? time() + ((int)$_POST['days'] * 86400) : 0).")";
$rIPBan = Query($qIPBan);
Alert(__("Added."), __("Notice"));
}
elseif($_GET['action'] == "delete")
{
$qIPBan = "delete from ipbans where ip='".justEscape($_GET['ip'])."' limit 1";
$rIPBan = Query($qIPBan);
Alert(__("Removed."), __("Notice"));
}
$qIPBan = "select * from ipbans order by date desc";
$rIPBan = Query($qIPBan);
$banList = "";
while($ipban = Fetch($rIPBan))
{
$cellClass = ($cellClass+1) % 2;
if($ipban['date'])
$date = gmdate($dateformat,$ipban['date'])." (".TimeUnits($ipban['date']-time())." left)";
else
$date = __("Permanent");
$banList .= format(
"
<tr class=\"cell{0}\">
<td>
{1}
</td>
<td>
{2}
</td>
<td>
{3}
</td>
<td>
<a href=\"ipbans.php?ip={1}&action=delete\">✘</a>
</td>
</tr>
", $cellClass, $ipban['ip'], $ipban['reason'], $date);
}
write("
<table class=\"outline margin width50\">
<tr class=\"header1\">
<th>".__("IP")."</th>
<th>".__("Reason")."</th>
<th>".__("Date")."</th>
<th> </th>
</tr>
{0}
</table>
<form action=\"ipbans.php\" method=\"post\">
<table class=\"outline margin width50\">
<tr class=\"header1\">
<th colspan=\"2\">
".__("Add")."
</th>
</tr>
<tr>
<td class=\"cell2\">
".__("IP")."
</td>
<td class=\"cell0\">
<input type=\"text\" name=\"ip\" style=\"width: 98%;\" maxlength=\"25\" />
</td>
</tr>
<tr>
<td class=\"cell2\">
".__("Reason")."
</td>
<td class=\"cell1\">
<input type=\"text\" name=\"reason\" style=\"width: 98%;\" maxlength=\"25\" />
</td>
</tr>
<tr>
<td class=\"cell2\">
".__("For")."
</td>
<td class=\"cell1\">
<input type=\"text\" name=\"days\" size=\"13\" maxlength=\"13\" /> ".__("days")."
</td>
</tr>
<tr class=\"cell2\">
<td></td>
<td>
<input type=\"submit\" name=\"action\" value=\"".__("Add")."\" />
</td>
</tr>
</table>
</form>
", $banList);
MakeCrumbs(array(__("Main")=>"./", __("IP ban manager")=>""), "");
?>