<?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 (mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `to`='".$user['id']."' AND `read`='0'"),0) && !isset($mail)){
echo'<div class="block_link">';
	echo"<a href=\"mails.php?act=new\">
 <img src='../img/icon/mail.png'> Новое сообщение</a></div>";
}
echo' <div class="empty_block item_center"> Эпоха сражений</div>';



echo " <center>
<img src='img/logo.png'>
</center>";

$camp=mysql_fetch_assoc(mysql_query("SELECT * FROM `campaign` WHERE `id_user`='".$user['id']."' LIMIT 1"));

               if($camp['limit']<=time() AND $camp['status']=='4'){
    mysql_query("UPDATE `campaign` SET `status`='0', `udar`='9', `kol`='1' WHERE `id_user`='".$user['id']."' LIMIT 1");
               }
               if($camp){
    if($camp['kol']>0){
        $metka='<span class="small green">[готов]</span>';
    }else{
$dtime = $camp[time] - $camp[limit];
        $metka='<span class="small grey">$dtime</span>';
    }
               }else{
                   $matka=FALSE;
               }
    
   echo" <div class='block_link'>
<a href='/campaign.php'><img src='/img/images/arrow.png' alt='*'/>
Поход<span style='float: right;'> $metka $dtime</span></a></div>";


echo'<div class="block_link">';
echo"<a href='ares.php'> <img src='img/images/arrow.png'> Арес</a></div>  ";


if($user[prava] == '3'){
echo' <div class="line"></div> ';
echo" <div class='block_link'>
 <a href='/admin'> <img src='img/images/arrow.png'> Админка</a></div>  ";}

echo' <div class="line"></div> ';
echo" <div class='block_link'>
 <a href='/magazin.php'> <img src='img/images/arrow.png'> Магазин</a></div>  ";

echo' <div class="line"></div> ';
echo" <div class='block_link'>
 <a href='/ratings.php'> <img src='img/images/arrow.png'> Топ ".mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id`"),0)." </a></div>  ";



///////


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