2015-06-18 10:11:20 +02:00
< ? php
2015-07-07 17:13:49 +02:00
function getCurrentBan ( $db , $sortBy = 'ban_date, ban_time' , $order = 'DESC' ) {
2015-07-21 15:37:55 +02:00
$sql = mysqli_query ( $db , " SELECT id,service,ip,ban_date,ban_time,country,countryCode FROM bans WHERE bans.id NOT IN ( SELECT unbans.id FROM unbans WHERE bans.id=unbans.id) ORDER BY $sortBy $order " );
2015-06-18 10:11:20 +02:00
while ( $rows = mysqli_fetch_assoc ( $sql )) {
$currentBan [] = $rows ;
}
if ( empty ( $currentBan )) {
$currentBan = array ();
}
mysqli_free_result ( $sql );
return $currentBan ;
}
2015-07-07 17:13:49 +02:00
//echo '<h3>Currently ',abs($currentlybanned),' ',$grammer,' banned.</h3>';
2015-07-21 16:02:24 +02:00
if ( empty ( $sortBy )) {
$sortBy = 'ban_date' ;
}
$currentBan = getCurrentBan ( $db , $sortBy , $order );
$nbCurrentBan = count ( $currentBan );
2015-06-18 10:11:20 +02:00
?>
2015-07-21 16:02:24 +02:00
< h2 > Currently Banned ( < ? php echo $nbCurrentBan ; ?> )</h2>
2015-06-18 10:11:20 +02:00
< div class = 'table' >
< div class = 'row' >
< div class = 'cell-header' >
2015-07-07 17:13:49 +02:00
< a href = " ?page=currentBan&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=currentBan&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=currentBan&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=currentBan&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=currentBan&sortBy=country&order=<?php echo $newOrder ?> " > Country </ a >
2015-06-18 10:11:20 +02:00
</ div >
</ div >
< ? php
foreach ( $currentBan 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 >
2015-07-03 16:04:10 +02:00
< div class = " cell " > ', $value[' country '].printFlag($value[' countryCode ']), ' </ div >
2015-06-18 10:11:20 +02:00
</ div > ' ;
}
?>
</ div >