<?
defined('PROTECTOR') or die('Error: restricted access');
if ($user_id=='1'){
if(empty($header)){
////////////////////////////////////////////////////////
echo'<div class="gameBorder">';
$t=time();
$req = mysql_query("SELECT * FROM `ban` WHERE `usr` = '$log' LIMIT 1");
// //////////////////////////
$avtob = mysql_num_rows($req);
if ($avtob == 1) {
    $ban = mysql_fetch_array($req);
    if($ban[ban_time]<$t){
    mysql_query("DELETE FROM `ban` WHERE `usr` = '$log'");
    }else{
if($ban[block]==1){
    echo"$div Вашему персонажу заблокирован доступ на сайт!<br> Причина: <b>$ban[text]!</b><br> Осталось: ";
$ban[ban_time]=$ban[ban_time]-time();
if($ban[ban_time]<60){
echo "$ban[ban_time] сек.";
}elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
$ban[ban_time]=round($ban[ban_time]/60);
echo "$ban[ban_time] мин.<br>";
echo "Забанил: $ban[admin]<br>";
}else{
$ban[ban_time]=round($ban[ban_time]/3600);
echo "$ban[ban_time] часов<br>";
echo "Забанил: $ban[admin]</br>";
}include('files/end.php');exit;}}}
//////////////////////////
/////////////////////
$q = mysql_query("SELECT COUNT(*) FROM `msg_r` WHERE `user_to` = '$log' AND `read` = '1';");
$new_mail = mysql_result($q, 0);
echo'</div><div class="heads">';
if($set[vip]==on){echo'<img src="pic/clan/18.gif" alt="*"/></a>';}
echo'
<img src="pic/hp.png" alt=""/>'.$udata['hp'].'
<img src="pic/mp.png" alt=""/>'.$udata['mp'].'
<img src="pic/bazar.gif" alt=""/>'.$udata['money'].'
<img src="pic/main/fp.png" alt=""/>'.$set['arenainv'].'';

echo ' <a href="msg.php?"><img src="/pic/main/pm.png" alt="*"/></a>';if($new_mail > 0){
echo"<a href=\"msg.php?mod=read\"><font color='#71cc71'>+$new_mail</font></a>";}


$pri = mysql_query("SELECT * FROM `zametka` WHERE `id` = '1' and `status`='on'");
$prim = mysql_num_rows($pri);
$prime = mysql_fetch_array($pri);
if($prim > 0 and $set[prim]==on){
echo"<div class='a'><div class='heads'><a href=\"index.php?mod=prim\"><font color='#ffc22b'><b> Объявление</b>
</font></a></div></div>";}

if($dueli==1){
$req = mysql_query("SELECT `duid` FROM `userduel` WHERE `usr` = '$log' LIMIT 1");
$duel = mysql_fetch_array($req);
$redu = mysql_query("SELECT * FROM `duel` WHERE `id` = '$duel[duid]' LIMIT 1");
$due = mysql_fetch_array($redu);
if($due[status]=="sob" and $due[time]<$t){
mysql_query("UPDATE `duel` SET `status` = 'begin' WHERE `usr` = '$log' and `id`='$due[id]'") or die (mysql_error());
}
$reduk = mysql_query("SELECT * FROM `duel` WHERE `id` = '$due[id]' LIMIT 1");
$duel = mysql_fetch_array($reduk);
$vremya1=$duel[time]-$t;
$vremy=floor($vremya1/60);
$vremya=$vremya1-($vremy*60);
if($vremya<10){$vremya="0$vremya";}
$vrem="$vremy:$vremya";
if($vremy<=-1){
$vrem="00:00";}
if($duel[status]=="sob"){ 
echo"<div class='log'>Вы участвуете в дуэли. начало через $vrem</div>";
}
if($duel[status]=="begin" and $head!=="duel"){ 
echo"<div class='log'><a href=\"duel.php?\">« Вернуться в бой</a></div>";
}
}

$req = mysql_query("SELECT * FROM `item_aura` WHERE `usr` = '$log' and `status`='1'");
$avto=mysql_num_rows($req);
if($avto==1){
$aur = mysql_fetch_array($req);
$req = mysql_query("SELECT * FROM `aurs` WHERE `usr`='$log'");
$avto=mysql_num_rows($req);
$aro = mysql_fetch_array($req);
echo'<div class="info">';
echo"<img src=\"pic/pers/aurs/$aur[ava]\"  width='15' height='15' alt=\"*\" \"/><b> $aur[name]</b> ";
$aro[actimer]=$aro[actimer]-time();
if($aro[actimer]<60){echo "осталось: $aro[actimer] сек.";}else{
$aro[actimer]=round($aro[actimer]/60);
echo "осталось: $aro[actimer] мин.";}
echo'</div>';}

@include('lvl.php');
echo'</div><div class="f_bg"></a>';}}else{
echo "<div class=\"f_bg\">Ошибка!Вы не авторизованы!<br><a href='index.php?vxod'>Авторизуйтесь</a>
<div>";
include('files/end.php');exit;}
?>