<?
define('PROTECTOR', 1);

$headmod = 'zona';//фикс. места

$textl='Тюрьма';
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
switch($_GET[mod]){

default:
$time=time();

//Навигация

if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0") 
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 10;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*10)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM ban"));
$puslap = floor($viso/10);

//Конец навигации


echo"<div class='event'>Народ должен знать своих героев</div><div class='event'>";
$req = mysql_query("SELECT * FROM `ban` WHERE `ban_time`>'$time' ORDER BY `id` DESC LIMIT $num,10");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
echo"<b>$mag[usr]</b> [<a href=\"zona.php?mod=1&amp;id=$mag[id]\">подробности</a>]<br/>";
}
//Навигация

if ($_GET[page] > 0)
{
echo "<a href=\"zona.php?page=$back\"> < Назад</a> ";
}
elseif ($_GET[page] == 0)
{
echo "";
}
echo"";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo " <a href=\"zona.php?page=$next\">Далее ></a>";}
else
{echo "";}

//Конец навигации
}else{
echo"<b>Нет забаненых!</b><br/>";
}
echo"</div><a href=\"index.php?\">Назад</a>";
break;

case '1':
if(empty($_GET[id])){
echo"Нет такого узника!";
include($path.'files/down.php');
exit;
}
$req = mysql_query("SELECT * FROM `ban` WHERE `id` = '$_GET[id]' LIMIT 1");
// //////////////////////////
$avto = mysql_num_rows($req);
if ($avto == 1) {
    $ban = mysql_fetch_array($req);
    
    if($ban[ban_time]<$t){
    mysql_query("DELETE FROM `ban` WHERE `usr` = '$log'");
    }else{
    echo"$ban[usr] находится в тюрме! Причина: $ban[text]! Осталось: ";
    
$ban[ban_time]=$ban[ban_time]-time();
if($ban[ban_time]<60){
echo "$ban[ban_time] сек.<br/>";
}elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
$ban[ban_time]=round($ban[ban_time]/60);
echo "$ban[ban_time] мин.<br/>";
}else{
$ban[ban_time]=round($ban[ban_time]/3600);
echo "$ban[ban_time] часов<br/>";
}
    }
    }else{
    echo"Нет такого узника!";
    }
    echo"<a href=\"zona.php?\">Назад</a>";
break;
}
include($path.'files/down.php');
?>