<?
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();
$req = mysql_query("SELECT * FROM `ban` WHERE `ban_time`>'$time'");
////////////////////////////
$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/>";
}
}else{
echo"<b>Нет забаненых!</b><br/>";
}
echo"<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');
?>