This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bans.php
92 lines (79 loc) · 2.2 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
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
<?php
include 'includes/header.php';
require 'includes/config.php';
?>
<body>
<?php
if($_SESSION['status'] == "admin")
{
?>
<div class="container">
<?php
$page='bans';
include 'includes/navbar.php';
include 'includes/file-nav.php';
?>
<div class="sub-page-main">
<div class="display-menu">
<!-- Or delete just the button if no buttons on the page -->
<!--<button class="btn-display-menu" type='submit' name='dosmth' ><i class="fas fa-trash-alt"></i> button example</button>-->
</div>
<?php
echo '<div class="main">';
$sqlGetBans = "SELECT * FROM BadLogins ORDER BY lastLogin DESC";
$resultsGetBans = mysqli_query($conn, $sqlGetBans);
if (mysqli_num_rows($resultsGetBans) > 0)
{
echo "<form method='POST'>";
echo '<table method="POST">';
echo '<tr>';
echo '<th>IP</th>';
echo '<th>Tries to login into account</th> ';
echo '<th>Banned till</th>';
echo '<th>Date</th>';
echo '<th>Delete</th>';
echo '</tr>';
while($row = mysqli_fetch_assoc($resultsGetBans))
{
echo "<tr>";
echo "<td>".$row['ip']."</td>";
echo "<td>".$row['tries']."</td>";
echo "<td>".$row['bannedTill']."</td>";
echo "<td>".$row['lastLogin']."</td>";
echo "<td><button name=".$row['id']." class='butonas'>X</button></td>";
echo "</tr>";
if(isset($_POST[$row['id']]))
{
$sqlDeleteThisBan = "DELETE FROM BadLogins WHERE id=".$row['id'];
if(mysqli_query($conn, $sqlDeleteThisBan))
{
echo "Succesfully unbanned ".$row['ip'];
//header("Refresh:0");
}
else
{
echo "Critical error bans.php.<br>!"; //neturetu but
}
}
}
echo "</table>";
echo "</form>";
}
else
{
echo "There are no banned IP's!<br>";
}
?>
</div>
</div>
<?php
}
else
{
echo '<meta http-equiv="refresh" content="0; url=./errorAuthorization.shtml" />';
echo "You are not authorised to view this page!<br>";
}
?>
</div>
</body>
</html>