View file users/ban_history.php

File size: 1.65Kb
<?
include('../core/core.php');
include(BASEDIR.INC.'func.php');
include(BASEDIR.INC.'session.php');
include(BASEDIR.INC.'session_user.php');
$mode = htmlspecialchars($_GET['mode']);
include(BASEDIR.INC.'head.php');
show_title('История банов');
$user = htmlspecialchars($_GET['user']);
if($user == !NULL){
echo '<div class="razdel">История банов '.$user.'</div>';
$o= mysql_query("SELECT count(*) FROM `history_ban` WHERE login = '".$user."'");
$r = mysql_fetch_row($o);
$t = $r[0];
define('TOPAGE',10);
$page=(int)$_GET['page'];  
     
   $q=mysql_result(mysql_query("SELECT COUNT(*) FROM `history_ban` WHERE login = '".$user."'"),0);  
      
    $total = intval(($q - 1) / TOPAGE) + 1;  
      
    if(empty($page) or $page < 0) $page = 1;  
      
    if($page > $total) $page = $total;  
      
    $start = $page * TOPAGE -TOPAGE;  

    $g=mysql_query("SELECT * FROM `history_ban` WHERE login = '".$user."' ORDER BY `id` DESC LIMIT $start,".TOPAGE."");  
while($u=mysql_fetch_array($g)){ 
echo'<div class="menu">';
echo 'Причина: '.$u['pri'].'<br />
Забанил: <a href="/users/profile.php?user='.$u['status'].'">'.$u['status'].'</a>';
echo'</div>';}

if($t == 0){ echo'<div class="menu">Банов пока что нету!</div>'; } 
       if ($page != $total) $nextpage = ' <a href="?mode=index&page='. ($page + 1) .'">Далее</a>';  
      if($page - 1 > 0) $pageback = '<a href="?mode=index&page='. ($page - 1) .'">Назад</a> ';  
echo''.$pageback.' '.$nextpage.'';






} else { echo'Ой ошибка!'; }

echo'<a href="/">На главную</a>';
include(BASEDIR.INC.'foot.php');
?>