Файл: mpanel/banlist.php
Строк: 50
<?php
include('../core/core.php');
include(MAINDIR.'style/head.php');
title('Список забаненых');
if (is_admin(array(101, 102, 103))) {
$my = DB::run() -> queryFetch("SELECT * FROM `users` WHERE `login`=? LIMIT 1",array(check($_COOKIE['login'])));
$admin = $my['status'];
echo'<div class="title">Управление сайтом</div>';
$act = '<img src="/images/act.png">';
//--------------------//
define('TOPAGE',10); $num = TOPAGE;
$links = '&page=';
$page = intval($_GET['page']);
$posts = DB::run() -> query("SELECT * FROM `ban`") -> rowCount();
$total = intval(($posts - 1) / $num) + 1;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$themes = DB::run()->query("SELECT * FROM `ban` ORDER BY `id` DESC LIMIT $start,".TOPAGE."");
$themes = $themes -> fetchAll();
foreach($themes AS $u){
if($u['ip'] == NULL){
echo'<div class="menu">';
echo '<strong>'.$u['login'].'</strong><br />';
$b = DB::run() -> queryFetch("SELECT * FROM history_ban WHERE login = ? ORDER BY `id` DESC LIMIT 1",array($u['login']));
$time = $u['time'] - time();
if($time < 0){ $time = 0; } else { $time = $time; }
echo'До окончания бана осталось '.formattime($time).'<br />';
echo 'Причина: '.$b['pri'].'<hr>';
echo 'Забанил: '.$b['status'].'<br />';
echo '<a href="zaban.php?mode=edit&uz='.$u['login'].'">Редактировать</a></div>';
echo'</div>';}
}
if ($page != 1) $pervpage = '<a href= '.$links.'1><<</a> <a href= '.$links.''. ($page - 1) .'><</a> ';
if ($page != $total) $nextpage = ' <a href= '.$links.''. ($page + 1) .'>></a> <a href= '.$links.'' .$total. '>>></a>';
if($page - 2 > 0) $page2left = ' <a href= '.$links.''. ($page - 2) .'>'. ($page - 2) .'</a> | ';
if($page - 1 > 0) $page1left = '<a href= '.$links.''. ($page - 1) .'>'. ($page - 1) .'</a> | ';
if($page + 2 <= $total) $page2right = ' | <a href= '.$links.''. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' | <a href= '.$links.''. ($page + 1) .'>'. ($page + 1) .'</a>';
if($posts == 0){ echo'<div class="menu">Бан-лист пустой!</div>'; } else {echo '<div class="menu_2">'.$pervpage.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.$nextpage.'</div>'; }
//-----------------//
echo'<div class="menu"><a href="/mpanel/">В админку</a></div>';
} else {header ('location: /index.php?mode=index'); }
include(MAINDIR.'style/foot.php');
?>