2015-06-18 10:11:20 +02:00
< ? php
2015-07-07 17:13:49 +02:00
function getLast24hBan ( $db , $sortBy = 'ban_date, ban_time' , $order = 'DESC' ) {
$getLast24hBan = mysqli_query ( $db , " SELECT service,ip,ban_date,ban_time,country, countryCode FROM bans WHERE concat_ws(' ',ban_date, ban_time) >= now() - INTERVAL 1 DAY ORDER BY $sortBy $order " );
2015-06-18 10:11:20 +02:00
while ( $rows = mysqli_fetch_assoc ( $getLast24hBan )) {
$lastBan [] = $rows ;
}
if ( empty ( $lastBan )) {
$lastBan = array ();
}
return $lastBan ;
}
2015-07-21 16:02:24 +02:00
if ( empty ( $sortBy )) {
$sortBy = 'ban_date' ;
}
$getLast24hBan = getLast24hBan ( $db , $sortBy , $order );
$nbLast24hBan = count ( $getLast24hBan );
2015-06-18 10:11:20 +02:00
?>
2015-07-21 16:02:24 +02:00
< h2 > Last 24 h ban ( < ? php echo $nbLast24hBan ; ?> )</h2>
2015-06-18 10:11:20 +02:00
< div class = 'table' >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=lastBan&sortBy=service&order=<?php echo $newOrder ?> " > Service </ a >
2015-06-18 10:11:20 +02:00
</ div >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=lastBan&sortBy=ip&order=<?php echo $newOrder ?> " > IP </ a >
2015-06-18 10:11:20 +02:00
</ div >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=lastBan&sortBy=ban_date&order=<?php echo $newOrder ?> " > Date </ a >
2015-06-18 10:11:20 +02:00
</ div >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=lastBan&sortBy=ban_time&order=<?php echo $newOrder ?> " > Time </ a >
2015-06-18 10:11:20 +02:00
</ div >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=lastBan&sortBy=country&order=<?php echo $newOrder ?> " > Country </ a >
2015-06-18 10:11:20 +02:00
</ div >
< ? php
foreach ( $getLast24hBan as $value ) {
echo '
< div class = " row " >
< div class = " cell " >
', $value[' service '], '
</ div >
< div class = " cell " >
', $value[' ip '], '
</ div >
< div class = " cell " >
', $value[' ban_date '], '
</ div >
< div class = " cell " >
', $value[' ban_time '], '
</ div >
< div class = " cell " >
2015-07-07 17:13:49 +02:00
', $value[' country '], printFlag($value[' countryCode ']), '
2015-06-18 10:11:20 +02:00
</ div >
</ div > ' ;
}
echo '
</ div >
' ;