<?
    
    include './system/common.php';
    
 include './system/functions.php';
        
      include './system/user.php';
        
    $title = 'Битва титанов';

include './system/h.php';  

    if($user) {
$gift = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_podarok` WHERE `user_id` = '".$user['id']."' order by `last_auth` desc limit 1"));
$time = $gift['last_auth'] + 86400;
$now = time();

$gift2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `boss01` WHERE `user_id` = '".$user['id']."' order by `last_auth` desc limit 1"));
$time2 = $gift2['last_auth'] + 7200;
$now2 = time();


# close news
     if($_GET['close_news'] == true) {
     mysql_query('UPDATE `users` SET `news_read` = "1" WHERE `id` = "'.$user['id'].'" LIMIT 1');
     header("Location: /?");
     exit;
     }
     if ($user['news_read'] == 0){
     $forum_r = mysql_query("SELECT * FROM `forum_topic` WHERE `sub`='1' ORDER by `id` DESC");
     $f = mysql_fetch_array($forum_r);

     $news = mysql_query('SELECT * FROM `forum_topic` WHERE `id` = "'.$f['id'].'"');
     while($news = mysql_fetch_array($news))
     {

 ?>

  



</div>
<div class='main' style='word-wrap:break-word;'>
<span style='text-shadow:none;'></span>
<div class='block_light center'>
<span class='dgreen'>Новая тема в новостях!</span>
<div class='separ'></div>
<img src='/images/icon/forum_2.png' alt=''/> 
<b><?=$news['name']?></b> 
<img src='/images/icon/forum_2.png' alt=''/>
<div class='mb10'></div>
<a class='btn' href='/forum/topic/<?=$news['id']?>/'><span class='end'><span class='label'>Посмотреть новость</span></span></a>
<br/><a href='/?close_news=true'>Скрыть</a></div>
<div class='mini-line'></div>
<?
     }
	 }
?>
<?
if ($time < $now) {
	
	

	
	
	
	
echo "</div>
<div class='main' style='word-wrap:break-word;'>
<span style='text-shadow:none;'></span>
<div class='block_light center'>
<span class='dgreen'>Мы рады тебя видеть!</span>
<div class='separ'></div>
<img src='/images/icon/forum_2.png' alt=''/> 
<b>Ежедневный бонус</b> 
<img src='/images/icon/forum_2.png' alt=''/>
<div class='mb10'></div>
<a class='btn' href='/bonus.php/'><span class='end'><span class='label'>Получить бонус</span></span></a></div>
 ";

}
?> 
<?
if($mail > 0) {

?>
</div>
<div class='main' style='word-wrap:break-word;'>
<span style='text-shadow:none;'></span>
  
<div class='menuList'><li class='center'><a href='/mail/'><img src='/images/icon/mail.png' alt=''/><span class='green'>Новая почта</span></a></li>
</div>
<div class='dot-line'></div>

<?

}
?>




<?



?>

<?

  

  $undying = mysql_query('SELECT * FROM `undying` WHERE `start` = "0" LIMIT 1');
  $undying = mysql_fetch_array($undying);  

?>



<?
  
if($undying) {

if(($undying['time'] - time())<=301 && ($undying['time'] - time())>0){

?>

</div>
<div class='main' style='word-wrap:break-word;'>
<span style='text-shadow:none;'></span>
<div class='menuList'>
<li><a href='/arena/'><img src='/images/icon/arena.png' alt=''/>игра продаеца копия 300р полностю 500р по всем вопросам писать в приват админу <?=($user['mp'] > 49 ? '<span class="green"> (+)</span>':'')?></a></li>

<div class='block_zero center'>
<img src='/images/barbars/enter.jpg' alt=''/>
<div class='mb10'></div>
<img src='/images/icon/2hit.png' alt=''/> 
<span class='dgreen bold'>Долина бессмертных</span> 
<img src='/images/icon/2hit.png' alt=''/><br/>Начало через 
<span id='time_28000'><?=makestime(($undying['time'] - time()))?></span>
<div class='separ'></div>
<a class='btn' href='/undying/'><span class='end'><span class='label'>Перейти к сражению</span></span></a></div>




<?

}

  }

?>

<?



?>
</div>
<div class='main' style='word-wrap:break-word;'>
<div class='dot-line'></div><div class='block_zero center'><img src='/images/town/hd/main.jpg' width='100%' alt=''/></div><div class='mini-line'></div>



<div class='menuList'>
<li><a href='/arena/'><img src='/images/icon/arena.png' alt=''/>Арена <?=($user['mp'] > 49 ? '<span class="green"> (+)</span>':'')?></a></li>




<?

  if($user['level'] > 4) {

?>

  <li><a href='/duel/'><img src='/images/icon/league.png' alt=''/>Дуэли <?=($user['duel_fights'] > 0 ? '<span class="green"> (+)</span>':'')?></a></li>


<?

  }
?>






<li><a href='/cave/'><img src='/images/icon/cave.png' alt=''/>Пещера <?=(($cave['dawn'] == 0 OR $cave['dawn'] == 1 && $cave['time'] <= time() OR $cave['dawn'] == 1 && $cave['gather'] == 1 && $cave['time'] <= time()) ? '<span class="green"> (+)</span>':'')?></a></li>



<li><a href='/sage/'><img src='/images/icon/quest.png' alt=''/>Хижина мудреца <span class='green'> (в разработке)</span></a></li>






<?

  

  $undying = mysql_query('SELECT * FROM `undying` WHERE `start` = "0" LIMIT 1');
  $undying = mysql_fetch_array($undying);  

?>

  <li><a href='/undying/'><img src='/images/icon/bar.png' alt='*'/> Долина бессмертных </a></li>

<?
  
if($undying) {

if(($undying['time'] - time())<=301 && ($undying['time'] - time())>0){

?>



<?

}

  }


?>

 </li>


<?

?>

<li><a href='/king/'><img src='/images/icon/king.png' alt=''/>Король бессмертных<br/>

<li><a href='/fights/'><img src='/images/icon/arena.png' alt=''/>Сражения <?=($undying_member['battle'] != $undying['id'] ? '<span class="green"> (+)</span>':'')?></a></li>





<?

  $cave = mysql_query('SELECT * FROM `cave` WHERE `user` = "'.$user['id'].'"');
  $cave = mysql_fetch_array($cave);


  

  if($user['level'] > 9) {

?>

<li><a href='/coliseum/'><img src='/images/icon/coliseum.png' alt=''/>Колизей</a></li>

<?

  }

  
?>


<?

if($user['level'] > 2) {

?>

  <li><a href='/farm/' style='display: block;'><img src='/images/icon/farm.png' alt='*'/>Поход

<?

  $farm = mysql_query('SELECT * FROM `farm` WHERE `user` = "'.$user['id'].'"');
  $farm = mysql_fetch_array($farm);

  if(!$farm OR $farm['h'] == 0 && $farm['time'] == 0 OR $farm['h'] > 0 && $farm['time'] <= time()) {

?>

<span class='green'> (+)</span>

<?

  }
  
  }

?>


</a></li>



</div>

<div class='mini-line'></div>
<div class='menuList'>

<li><a class='dgreen' href='/trade/'><img src='/images/icon/gold.png' alt=''/>Получить золото<span class='green'> (+)</span></a></li>



<li><a href='/shop/'><img src='/images/icon/equip.png' alt=''/>Магазин снаряжения</a></li>



<li><a href='/smith/'><img src='/images/icon/smith.png' alt=''/>Кузница<br/>
<span class='white small'>Руны, заточка, бонус</span></a></li>

<li><a href='/lab/'><img src='/images/icon/lab.png' alt=''/>Лаборатория<br/>
<span class='white small'>Эффекты, усиления, эликсиры</span></a></li></div>









<?

    if(isSet($_GET['exit'])) {
    
        setCookie('id', '');
  setCookie('password', '');
    
    header('location: /');
    
    }
    


    }
    else
    {


$login = _string($_POST['login']);
  $login = strToLower($login);

    $password = _string($_POST['password']);


    if($login && $password) {
    
    $q = mysql_query('SELECT * FROM `users` WHERE `login` = "'.$login.'" AND `password` = "'.$password.'" LIMIT 1');
 
 $user = mysql_fetch_array($q);
      
      if($user) {
    
    setCookie('id', $user['id'], time() + 86400, '/');
setCookie('password', $password, time() + 86400, '/');
    
    
      header('location: /');
      
      }
    
    }

$ref = _string(_num($_GET['ref']));

?>
<div>
<audio src="/file.mp3" autoplay=""></audio>
<div class='main' style='word-wrap:break-word;'>
<span style='text-shadow:none;'></span>
<div class='center'>
<img src='/images/logo/bitva_titanov.png' alt='Битва титанов' height='40px'/><br/>
<img src='/images/town/hd/main.jpg' width='100%' alt=''/></div>
<div class='block_zero center'><h1>Сражайся вместе с нами</h1>
<span class='medium'>Впервые на мобильниках. Игра, о которой ходят легенды<br/>
Теперь к легенде можешь прикоснуться и ты!</span>
<div class='mb10'></div>
<h1 class='yellow'>В игре уже <?=n_f(mysql_result(mysql_query('SELECT COUNT(*) FROM `users`'),0))?> игроков!</h1></div>
<div class='mini-line' style='margin-top:5px;'></div>
<div class='block_zero center' style='padding-top:15px;'>
<div class='bigBtn'><a class='btn' href='/start/'>
<span class='end'><span class='label'>
<span class='green'>Начать свой путь</span></span></span></a></div></div>
<div class='separ'></div>



<?

if(isset($_GET['vxod'])){

echo '

игра продаеца копия 300р полностю 500р по всем вопросам писать в приват админу

<div class="block_zero center" style="padding-bottom:8px;">

<form action="/" method="post"><div style="margin-bottom:10px;">Имя персонажа:<br/>
<input class="text medium-text" type="text" name="login" value=""/><br/>Пароль:<br/>
<input class="text medium-text" type="password" name="password"/><br/>
<span class="btn"><span class="end"><input class="label" type="submit" value="Войти">Войти</span></span></div>
<a class="btn" href="/pass/"><span class="end"><span class="label">Забыли пароль?</span></span></a></form></div>
<div class="mini-line"></div>
';

?>

<?

}else{
echo "

<div class='block_zero center' style='padding:12px;'>
<a class='btn' href='index.php?vxod'><span class='end'><span class='label'>Войти</span></span></a></div>";

}

?>


<div class='block_zero'><div class='center'><img src='/images/icon/2hit.png' alt=''/> 
<span class='bold'>Об игре</span> <img src='/images/icon/2hit.png' alt=''/></div>
<ul>«Битва титанов» - захватывающая игра, для мобильных телефонов<br/>
Сражения, приключения, общение, любовь - всё это, неотъемлемая часть нашего мира</ul></div></div><br/>
<div class='center'><div class='mb10'></div><span class='medium grey'>
</span>
</div><span style='text-shadow:none;'></span></div>

<?

    }
    
include './system/f.php';

?>