<?php
include '../system/bd.php';
include '../system/cook.php';
include ("../system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include '../system/head.php';
include '../system/head1.php';

if($user[prava] <= '2'){
header ("Location: ../error.php");}


switch($_GET[mod]){
default:

echo" <div class='title'>
Админ лог </div>";

$cop=5;
$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log`"),0);
$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';
$req = mysql_query("SELECT * FROM `admin_log`  ORDER by `id` DESC LIMIT $start,$cop  ");
$avto=mysql_num_rows($req);
if($avto==0){
echo"<img src=\"pic/main/!.png\"> Нет истории.";

}else{
while($chat = mysql_fetch_array($req))
{



$d = time()-$chat['time'];
echo"
<div class='block'>

$chat[msg] 

</br><span class='role0'> (".sec2day($d)." назад)</span>
</div> ";
}
echo '
<div class="empty_block top pagi item_center">
<center>';
if($page-1>0){
echo '<a href="mod_4.php?&page='.($page-1).'">&lt;</a> ';
}
if($page-1>0){
echo '<a href="mod_4.php?&page='.($page-1).'">'.($page-1).'</a> ';
}
echo '<b>'.$page.'</b>';
if($page+1<=$cp){
echo ' <a href="mod_4.php?&page='.($page+1).'">'.($page+1).'</a>';
}
if($page+1<=$cp){
echo ' <a href="mod_4.php?&page='.($page+1).'">&gt;</a>';
}
echo "</center></div>";
}

}
//////////////////

}else{
header ("Location: index.php"); exit;
}
include '../system/foot.php';
?>
