[add] sort by service
This commit is contained in:
parent
e9b2821682
commit
bf3e9aabef
33
index.php
33
index.php
|
@ -25,13 +25,13 @@ $database = $config['mysqldb'];
|
|||
$page = htmlspecialchars($_GET["page"]);
|
||||
$orderby = htmlspecialchars($_GET["orderby"]);
|
||||
// Connect to MySQL
|
||||
if (!$db = mysqli_connect($db_host, $db_user, $db_pwd)) {
|
||||
if (!$db = mysqli_connect($db_host, $db_user, $db_pwd)) {
|
||||
die("Can't connect to database");
|
||||
}
|
||||
if (!mysqli_select_db($db,$database)) {
|
||||
}
|
||||
if (!mysqli_select_db($db, $database)) {
|
||||
mysqli_close($db);
|
||||
die("Can't select database");
|
||||
}
|
||||
}
|
||||
// Get some information from the database
|
||||
// Find IPs banned more than once
|
||||
$multiplebans = mysqli_query($db, "SELECT ip,COUNT(*) count,country FROM bans GROUP BY ip HAVING count > 1 ORDER BY count DESC");
|
||||
|
@ -71,22 +71,27 @@ if (!$multiplebans) {
|
|||
die("Query failed.");
|
||||
}
|
||||
// Order by IP
|
||||
$allbans_ip = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ip");
|
||||
$allbans_ip = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ip, id");
|
||||
if (!$multiplebans) {
|
||||
die("Query failed.");
|
||||
}
|
||||
// Order by Date
|
||||
$allbans_date = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ban_date");
|
||||
$allbans_date = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ban_date, id");
|
||||
if (!$multiplebans) {
|
||||
die("Query failed.");
|
||||
}
|
||||
// Order by Time
|
||||
$allbans_time = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ban_time");
|
||||
$allbans_time = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY ban_time, id");
|
||||
if (!$multiplebans) {
|
||||
die("Query failed.");
|
||||
}
|
||||
// Order by Country
|
||||
$allbans_country = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY country");
|
||||
$allbans_country = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY country, id");
|
||||
if (!$multiplebans) {
|
||||
die("Query failed.");
|
||||
}
|
||||
// Order by Service
|
||||
$allbans_service = mysqli_query($db, "SELECT id,service,ip,ban_date,ban_time,country FROM bans ORDER BY service, id");
|
||||
if (!$multiplebans) {
|
||||
die("Query failed.");
|
||||
}
|
||||
|
@ -182,7 +187,7 @@ switch ($page) {
|
|||
echo "\t<div class='table'>\n";
|
||||
echo "\t\t<div class='row'>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=id' class='cell-header'>\n\t\t\t\t\n\t\t\t</a>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=ip' class='cell-header'>\n\t\t\t\t<u>Service</u>\n\t\t\t</a>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=service' class='cell-header'>\n\t\t\t\t<u>Service</u>\n\t\t\t</a>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=ip' class='cell-header'>\n\t\t\t\t<u>IP</u>\n\t\t\t</a>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=date' class='cell-header'>\n\t\t\t\t<u>Ban Date</u>\n\t\t\t</a>\n";
|
||||
echo "\t\t\t<a href='?page=allbans&orderby=time' class='cell-header'>\n\t\t\t\t<u>Ban Time</u>\n\t\t\t</a>\n";
|
||||
|
@ -229,6 +234,14 @@ switch ($page) {
|
|||
echo "\t\t</div>\n";
|
||||
}
|
||||
break;
|
||||
case "service" :
|
||||
while ($row = mysqli_fetch_row($allbans_service)) {
|
||||
echo "\t\t<div class='row'>\n";
|
||||
foreach ($row as $cell)
|
||||
echo "\t\t\t<div class='cell'>\n\t\t\t\t$cell\n\t\t\t</div>\n";
|
||||
echo "\t\t</div>\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo "\t</div>\n";
|
||||
break;
|
||||
|
@ -236,7 +249,7 @@ switch ($page) {
|
|||
echo "</div>\n";
|
||||
$stop = microtime(true);
|
||||
$total = round($stop - $start, 4);
|
||||
echo $total, '</br>';
|
||||
echo 'Generate in ', $total, ' secondes</br>';
|
||||
echo "<div id='footer'>\n";
|
||||
echo "\t©", date("Y"), " released under GNU GPL base on <a href='http://kylefberry.net'>k6b</a> work this version are made by Knah Tsaeb\n";
|
||||
echo "</div>\n";
|
||||
|
|
Loading…
Reference in a new issue