<?php
 ob_start();

  list($msec,$sec)
             = explode(chr(32), microtime()); 
  $gtime     = $sec+$msec; 
   

switch($user['level']) {
    
      case 1:
          $exp = 42;
       break;

      case 2:
          $exp = 55;
       break;

      case 3:
          $exp = 104;
       break;

      case 4:
          $exp = 195;
       break;

      case 5:
          $exp = 298;
       break;

      case 6:
          $exp = 388;
       break;

      case 7:
          $exp = 512;
       break;

      case 8:
          $exp = 881;
       break;

      case 9:
          $exp = 1282;
       break;

      case 10:
          $exp = 1632;
       break;

      case 11:
          $exp = 2287;
       break;

      case 12:
          $exp = 3045;
       break;

      case 13:
          $exp = 4756;
       break;

      case 14:
          $exp = 6390;
       break;

      case 15:
          $exp = 8927;
       break;

      case 16:
          $exp = 11960;
       break;

      case 17:
          $exp = 14515;
       break;

      case 18:
          $exp = 19023;
       break;

      case 19:
          $exp = 25966;
       break;

      case 20:
          $exp = 32553;
       break;

      case 21:
          $exp = 39951;
       break;

      case 22:
          $exp = 47205;
       break;

      case 23:
          $exp = 58995;
       break;

      case 24:
          $exp = 70894;
       break;

      case 25:
          $exp = 85995;
       break;

      case 26:
          $exp = 99192;
       break;

      case 27:
          $exp = 120172;
       break;

      case 28:
          $exp = 146240;
       break;

      case 29:
          $exp = 180991;
       break;

      case 30:
          $exp = 201027;
       break;

      case 31:
          $exp = 240016;
       break;

      case 32:
          $exp = 273061;
       break;

      case 33:
          $exp = 299979;
       break;

      case 34:
          $exp = 350000;
       break;

      case 35:
          $exp = 500000;

       break;

      case 36:
          $exp = 600000;
       break;

      case 37:
          $exp = 725000;
       break;

      case 38:
          $exp = 850000;
       break;

      case 39:
          $exp = 975000;
       break;

      case 40:
          $exp = 1100000;
       break;

      case 40:
          $exp = 1100000;
       break;

      case 41:
          $exp = 1225000;
       break;

      case 42:
          $exp = 1350000;
       break;

      case 43:
          $exp = 1475000;
       break;

      case 44:
          $exp = 1600000;
       break;

      case 45:
          $exp = 1725000;
       break;

      case 46:
          $exp = 1850000;
       break;

      case 47:
          $exp = 1975000;
       break;
       
      case 48:
          $exp = 2100000;
       break;

      case 49:
          $exp = 2225000;
       break;

      case 50:
          $exp = 2500000;
       break;

      case 51:
          $exp = 2700000;
       break;

      case 52:
          $exp = 2900000;
       break;

      case 53:
          $exp = 3100000;
       break;

      case 54:
          $exp = 3300000;
       break;

      case 55:
          $exp = 3500000;
       break;

      case 56:
          $exp = 3700000;
       break;

      case 57:
          $exp = 3900000;
       break;

      case 58:
          $exp = 4100000;
       break;

      case 59:
          $exp = 4500000;
       break;
      
      case 60:
      
          $exp = 0;
      
        break;

    }
        
        $exp_progress = round(100/($exp/$user['exp']));

    
    if($exp_progress > 100) {
        
     
        $exp_progress = 100;
     
        }
?>
<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.0//EN' 'http://www.wapforum.org/DTD/xhtml-mobile10.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<meta name="author" content="Maxsimus &amp; Tera">
<meta name="keywords" content="битва титанов, титаны, онлайн игра, тивар, tiwar, MMORPG"> 
<meta name="viewport" content="width=device-width,maximum-scale=1.0,initial-scale=1.0,user-scalable=no"><meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="/style.css?103l">
<link rel="icon" href="/favicon.ico?2" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico?2" type="image/x-icon">
<title><?=$title;?></title></head>
<body>
<div id="topdiv"><div class="main" style="word-wrap:break-word;">

<div class="head  cntr" style="position:relative;" onclick="location.href='/';">
<span class="ttl fl"><?=$title;?></span>
<span class="bl rght nwr">
<img src="/images/icon/health.png" alt="hp"> <span class="white"><?=$user['hp'];?></span> | <img src="/images/icon/mana.png" alt="mp"> <?=$user['mp'];?></span><div class="clr"></div></div>
<div class="exp_bar"><div class="progress" style="width:<?=$exp_progress?>%"></div></div>


<?

if($user['level'] < 60 && $user['exp'] >= $exp) {
        
        $g = 10 + ($user['level'] * 5) - 5;
    
    mysql_query('UPDATE `users` SET `level` = `level` + 1,
                                      `exp` = "0",
                                       `hp` = "'.($user['vit'] * 2).'",
                                       `mp` = "'.$user['mana'].'",
                                        `g` = "'.($user['g'] + $g).'" WHERE `id` = "'.$user['id'].'"');
                                        if($user['level']+1 == 4){?>
                                        
                                        <div class="block_outer center" style="margin:7px 4px 7px 4px;">
                                        <img src="/images/icon/2hit.png" alt="">
                                         <span class="dgreen bold">Поздравляем!</span> 
                                         <img src="/images/icon/2hit.png" alt=""><div class="separ"></div>
                                         Ты получил <span class="dgreen">4</span> уровень!<br>
                                         <span class="blue">Награда:</span> <img src="/images/icon/gold.png" alt=""> 20 золота<div class="separ"></div><span class="yellow">Забери награду за <img src="/images/icon/quest.png" alt=""> ежедневные задания!</span><div class="mb10"></div><a class="btn" href="/quest/"><span class="end"><span class="label">Перейти в хижину мудреца</span></span></a></div>
                                        
                                        <?
                                        }else{
if($user['level']!=3){
?>
<div class="block_outer center" style="margin:7px 4px 7px 4px;">
<img src="/images/icon/2hit.png" alt=""> <span class="dgreen bold">Поздравляем!</span> <img src="/images/icon/2hit.png" alt=""><br/>
<? if($user['level']+1 != 3){?><div class="separ"></div><?}?>Ты получил <span class="dgreen"><?=($user['level']+1);?></span> уровень!<br><? if($user['level']+1 == 3){?><div class="separ"></div><?}?>
<? if($user['level']+1 != 3){?>
<span class="blue">Награда:</span> <img src="/images/icon/gold.png" alt=""> <?=n_f($g);?> золота
<?}?>

<?
 if($user['level']+1 == 2){?>
<div class="separ"></div>
<span class="yellow">Тебе доступна <img src="/images/icon/duel.png" alt=""> Карьера!</span>
<div class="mb10"></div>
<a class="btn" href="/career/"><span class="end"><span class="label">Перейти в Карьеру</span></span></a>
<?}elseif($user['level']+1 == 3){
    mysql_query('INSERT INTO `inv` SET `user`="'.$user['id'].'",`item`="78",`quality`="2",`bonus`="10",`new`="1",`_str`="45",`_def`="45",`_agi`="45",`_vit`="45"');
?>
<span class="blue bold">Награда:</span>
<div class="mb5"></div>
    <div style="display:inline-block;white-space:nowrap;text-align:left;">
    <span class="yellow"><div class="item50 ibl fl" style="background-image:url(&quot;http://5.9.146.51/itemimage/78/0/0/3711470294.w?4&quot;);margin-right:5px;"><div class="it_brd q2p sh8"><div class="it_stat1"></div>
    <div class="clb"></div><div class="it_stat2 cntr"><div class="it_stars"></div></div></div></div>
    </span><span class="yellow">Топор рыцаря</span><span class="small"><br><img src="/images/icon/grade/2p.png" alt=""> <span class="quality-2p">Обычный+</span><br>
    <span class="green">+60 мощь</span></span><div style="clear:both;"></div></div><div class="separ"></div>
    <span class="medium">Для того чтобы надеть оружие, прокачай <img src="/images/icon/skill.png" alt=""> Мастерство до 6</span><div class="mb10"></div>
    <a class="btn" href="/train/"><span class="end"><span class="label">Перейти в тренировку</span></span></a>
    <?}?>
</div>



<?
}
        
    }
 
   
    
   } 
if (isset($_SESSION['inf']))
{
echo $_SESSION['inf'];
$_SESSION['inf'] = null;
}



