-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathadmin_bl.php
60 lines (60 loc) · 1.68 KB
/
admin_bl.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
<?php
require_once('config.php');
include('header.php');
if($_SESSION['admin_logged_in'] == true)
{
if(isset($_REQUEST["action"]))
{
$action = htmlspecialchars($_REQUEST["action"], ENT_QUOTES, 'UTF-8');
if($action == "del")
{
$id = $_GET["id"];
$sql->query("delete from `blacklist` where `id`='$id'");
exit(header("Location: admin_bl.php"));
}
if($action == "add")
{
$agent = $_POST['useragent'];
$sql->query("INSERT INTO `blacklist` (`useragent`) VALUES ('$agent')");
exit(header("Location: admin_bl.php"));
}
}
echo '<div class="container">
<table class="table table-hover">
<thead>
<tr>
<td>ID</td>
<td>User Agent</td>
<td>Remove</td>
</tr>
</thead>
<tbody>';
$data = $sql->query("select * from `blacklist`");
if($data->num_rows >= 1)
{
while($row = $data->fetch_row())
{
echo "<tr>
<td>".$row[0]."</td>
<td>".$row[1]."</td>
<td><a class='btn btn-danger' href='admin_bl.php?action=del&id=".$row[0]."'>Remove</a></td>
</tr>";
}
}
else
echo "<tr><td>0</td><td>No client in blacklist</td><td>-</td></tr>
</tbody>
</table>
<hr/>";
echo '</tbody>
</table>
<hr/>
<form action="admin_bl.php" method="POST">
<div class="form-group">
<label>Add User-Agent to blacklist</label>
<input type="text" class="form-control" placeholder="BitComet" name="useragent" />
</div>
<button type="submit" class="btn btn-primary" name="action" value="add">Add</button>
</from>
</div></body></html>';
}