MyFail2BanInfo/page/allBans.php

39 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2015-06-18 10:11:20 +02:00
<?php
// Order by ID
2015-07-07 17:13:49 +02:00
function getAllBan($db, $sortBy = 'ban_date, ban_time', $order = 'DESC') {
$sql = "SELECT id,service,ip,ban_date,ban_time,country,countryCode FROM bans ORDER BY $sortBy $order";
2015-06-18 10:11:20 +02:00
$res = mysqli_query($db, $sql);
while ($rows = mysqli_fetch_assoc($res)) {
$allBan[] = $rows;
}
if (empty($allBan)) {
$allBan = array();
}
return $allBan;
}
?>
2015-07-21 16:02:24 +02:00
<h2>All time banned</h2>
2015-06-18 10:11:20 +02:00
<div class='table'>
<div class='row'>
2015-07-07 17:13:49 +02:00
<a href="?page=allBans&amp;sortBy=service&amp;order=<?php echo $newOrder?>" class='cell-header'>Service</a>
<a href="?page=allBans&amp;sortBy=ip&amp;order=<?php echo $newOrder?>" class='cell-header'>IP</a>
<a href="?page=allBans&amp;sortBy=ban_date&amp;order=<?php echo $newOrder?>" class='cell-header'>Ban Date</a>
<a href="?page=allBans&amp;sortBy=ban_time&amp;order=<?php echo $newOrder?>" class='cell-header'>Ban Time</a>
<a href="?page=allBans&amp;sortBy=country&amp;order=<?php echo $newOrder?>" class='cell-header'>Country</a>
2015-06-18 10:11:20 +02:00
</div>
<?php
2015-07-07 17:13:49 +02:00
if (empty($sortBy)) {
$sortBy = 'ban_date';
2015-06-18 10:11:20 +02:00
}
2015-07-07 17:13:49 +02:00
$allBan = getAllBan($db, $sortBy, $order);
2015-06-18 10:11:20 +02:00
foreach ($allBan as $value) {
echo '<div class="row">';
echo '<div class="cell">', $value['service'], '</div>';
echo '<div class="cell">', $value['ip'], '</div>';
echo '<div class="cell">', $value['ban_date'], '</div>';
echo '<div class="cell">', $value['ban_time'], '</div>';
2015-07-07 17:13:49 +02:00
echo '<div class="cell">', $value['country'].printFlag($value['countryCode']), '</div>';
2015-06-18 10:11:20 +02:00
echo '</div>';
}
?>
</div>