<?
define('PROTECTOR', 1);

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

$textl='Тюрма';
include('files/db.php');
include('files/auth.php');
include('files/func.php');
include('files/core.php');
include('files/head.php');
include('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><a href=\"search.php?nick=$mag[usr]&amp;go=go\">$mag[usr]</a></b> [<a href=\"zona.php?mod=1&amp;id=$mag[id]\">подробности</a>]<br/>";
}
}else{
echo"<b>Нет забаненых!</b><br/>";
}
echo"<a href=\"main.php?\">Назад</a>";
break;

case '1':
if(empty($_GET[id])){
echo"Нет такого узника!";
include('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] находится в тюрме!</br>Причина: $ban[text]!</br>Осталось: ";
    
$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/>";
}elseif($ban[ban_time]>3600 and $ban[ban_time]<86400){
$ban[ban_time]=round($ban[ban_time]/3600);
echo "$ban[ban_time] часов.<br/>";
}else{
$ban[ban_time]=round($ban[ban_time]/86400);
echo "$ban[ban_time] суток.<br/>";
}
if(!empty($ban[admin])){echo"Забанил: $ban[admin]</br>";}
}

    }else{
    echo"Нет такого узника!";
    }
    echo"<a href=\"zona.php?\">Назад</a>";
break;
}
include('files/down.php');
?>