[add] top ten service
This commit is contained in:
parent
772e83331d
commit
58b5e86d5b
|
@ -122,6 +122,7 @@ echo "\t\t\t<a href='?page=currentBan' class='menu'>Current ban</a>\n";
|
|||
echo "\t\t\t<a href='?page=lastBan' class='menu'>Last 24h</a>\n";
|
||||
echo "\t\t\t<a href='?page=allBans' class='menu'>All time</a>\n";
|
||||
echo "\t\t\t<a href='?page=topTen' class='menu'>Top 10 countries</a>\n";
|
||||
echo "\t\t\t<a href='?page=topTenService' class='menu'>Top 10 services</a>\n";
|
||||
echo "\t\t</div>\n";
|
||||
echo "\t</div>\n";
|
||||
if ($page === 'home' || empty($page)) {
|
||||
|
@ -139,6 +140,9 @@ if ($page === 'lastBan') {
|
|||
if ($page === 'topTen') {
|
||||
require 'page/topTen.php';
|
||||
}
|
||||
if ($page === 'topTenService') {
|
||||
require 'page/topTenService.php';
|
||||
}
|
||||
if ($page === 'allBans') {
|
||||
require 'page/allBans.php';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
// Find multiple country bans
|
||||
function topTen($db) {
|
||||
$countrybans = mysqli_query($db, "SELECT service,COUNT(*) count FROM bans GROUP BY service ORDER BY count DESC LIMIT 10");
|
||||
while ($rows = mysqli_fetch_assoc($countrybans)) {
|
||||
$topTen[] = $rows;
|
||||
}
|
||||
if (empty($topTen)) {
|
||||
$topTen = array();
|
||||
}
|
||||
mysqli_free_result($countrybans);
|
||||
return $topTen;
|
||||
}
|
||||
?>
|
||||
<h2>Top 10 Countries</h2>
|
||||
<div class='table'>
|
||||
<div class='row'>
|
||||
<div class='cell-header'>
|
||||
Bans
|
||||
</div>
|
||||
<div class='cell-header'>
|
||||
Country
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$topTen = topTen($db);
|
||||
foreach ($topTen as $value) {
|
||||
echo '<div class="row">';
|
||||
echo '<div class="cell">', $value['count'], '</div>';
|
||||
echo '<div class="cell">', $value['service'], '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
Loading…
Reference in New Issue