<?
    
    include './system/common.php';
    
 include './system/functions.php';
        
      include './system/user.php';
    
if(!$user) {

  header('location: /');
    
exit;

}
    
    $title = 'Тренировка';


include './system/h.php';  
    
    function cost($i) {
        
        switch($i) {
          case 0:
           $cost = 200;
           break;
        
          case 1:
           $cost = 400;
           break;
        
          case 2:
           $cost = 600;
           break;
          
          case 3:
           $cost = 800;
           break;

          case 4:
           $cost = 1000;
           break;   
           
          case 5:
           $cost = 1;
           break;        

          case 6:
           $cost = 1600;
           break;   

          case 7:
           $cost = 3200;
           break;

          case 8:
           $cost = 4800;
           break;   
           
          case 9:
           $cost = 6400;
           break;   

          case 10:
           $cost = 8000;
           break;   

          case 11:
           $cost = 10;
           break;   

          case 12:
           $cost = 2400;
           break;   

          case 13:
           $cost = 4800;
           break;   

          case 14:
           $cost = 7200;
           break;   

          case 15:
           $cost = 9600;
           break;   

          case 16:
           $cost = 12000;
           break;   

          case 17:
           $cost = 20;
           break;   

          case 18:
           $cost = 3200;
           break;   

          case 19:
           $cost = 7200;
           break;   

          case 20:
           $cost = 10800;
           break;   

          case 21:
           $cost = 14400;
           break;   

          case 22:
           $cost = 18000;
           break;   

          case 23:
           $cost = 40;
           break;   

          case 24:
           $cost = 3600;
           break;   

          case 25:
           $cost = 7200;
           break;   

          case 26:
           $cost = 10800;
           break;   

          case 27:
           $cost = 14400;
           break;   

          case 28:
           $cost = 18000;
           break;   

          case 29:
           $cost = 80;
           break;   

          case 30:
           $cost = 4800;
           break;   

          case 31:
           $cost = 9600;
           break;   

          case 32:
           $cost = 14400;
           break;   

          case 33:
           $cost = 19200;
           break;   

          case 34:
           $cost = 24000;
           break;   

          case 35:
           $cost = 160;
           break;   

          case 36:
           $cost = 5600;
           break;   

          case 37:
           $cost = 11200;
           break;   

          case 38:
           $cost = 16800;
           break;   

          case 39:
           $cost = 22400;
           break;   

          case 40:
           $cost = 28000;
           break;   

          case 41:
           $cost = 320;
           break;   

          case 42:
           $cost = 6400;
           break;   

          case 43:
           $cost = 12800;
           break;   

          case 44:
           $cost = 19200;
           break;   

          case 45:
           $cost = 25600;
           break;   

          case 46:
           $cost = 32000;
           break;   

          case 47:
           $cost = 640;
           break;   

          case 48:
           $cost = 7200;
           break;   

          case 49:
           $cost = 14400;
           break;   

          case 50:
           $cost = 21600;
           break;   

          case 51:
           $cost = 28800;
           break;   

          case 52:
           $cost = 36000;
           break;   

          case 53:
           $cost = 1280;
           break;   

          case 54:
           $cost = 5000;
           break;   

          case 55:
           $cost = 16000;
           break;   

          case 56:
           $cost = 24000;
           break;   

          case 57:
           $cost = 32000;
           break;   

          case 58:
           $cost = 40000;
           break;   

          case 59:
           $cost = 2560;
           break;   

        }
        
    return $cost;
    
    }

    function value($i) {
        
        switch($i) {
          case 0:
           $value = 's';
           break;
        
          case 1:
           $value = 's';
           break;
        
          case 2:
           $value = 's';
           break;
          
          case 3:
           $value = 's';
           break;

          case 4:
           $value = 's';
           break;        

          case 5:
           $value = 'g';
           break;        

          case 6:
           $value = 's';
           break;        

          case 7:
           $value = 's';
           break;        

          case 8:
           $value = 's';
           break;        

          case 9:
           $value = 's';
           break;        

          case 10:
           $value = 's';
           break;        

          case 11:
           $value = 'g';
           break;        

          case 12:
           $value = 's';
           break;        

          case 13:
           $value = 's';
           break;        

          case 14:
           $value = 's';
           break;        

          case 15:
           $value = 's';
           break;        

          case 16:
           $value = 's';
           break;        

          case 17:
           $value = 'g';
           break;        

          case 18:
           $value = 's';
           break;        
        
          case 19:
           $value = 's';
           break;        

          case 20:
           $value = 's';
           break;        
          
          case 21:
           $value = 's';
           break;        
          
          case 22:
           $value = 's';
           break;     
              
          case 23:
           $value = 'g';
           break;        

          case 24:
           $value = 's';
           break;     

          case 25:
           $value = 's';
           break;     

          case 26:
           $value = 's';
           break;     

          case 27:
           $value = 's';
           break;     

          case 28:
           $value = 's';
           break;     

          case 29:
           $value = 'g';
           break;     

          case 30:
           $value = 's';
           break;     

          case 31:
           $value = 's';
           break;     

          case 32:
           $value = 's';
           break;     

          case 33:
           $value = 's';
           break;     

          case 34:
           $value = 's';
           break;     

          case 35:
           $value = 'g';
           break;     

          case 36:
           $value = 's';
           break;     

          case 37:
           $value = 's';
           break;     

          case 38:
           $value = 's';
           break;     

          case 39:
           $value = 's';
           break;     

          case 40:
           $value = 's';
           break;     

          case 41:
           $value = 'g';
           break;     

          case 42:
           $value = 's';
           break;     

          case 43:
           $value = 's';
           break;     

          case 44:
           $value = 's';
           break;     

          case 45:
           $value = 's';
           break;     

          case 46:
           $value = 's';
           break;     

          case 47:
           $value = 'g';
           break;     

          case 48:
           $value = 's';
           break;     

          case 49:
           $value = 's';
           break;     

          case 50:
           $value = 's';
           break;     

          case 51:
           $value = 's';
           break;     

          case 52:
           $value = 's';
           break;     

          case 53:
           $value = 'g';
           break;     

          case 54:
           $value = 's';
           break;     

          case 55:
           $value = 's';
           break;     

          case 56:
           $value = 's';
           break;     

          case 57:
           $value = 's';
           break;     

          case 58:
           $value = 's';
           break;     

          case 59:
           $value = 'g';
           break;     

        }
    
    return $value;
    
    }

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

if($user['_str'] < 61) {

    if(value($user['_str']) == 's') {

      if($user['s'] < cost($user['_str'])) {
      
        
      
      }
      else
      {
      
          mysql_query('UPDATE `users` SET `str` =   `str` + 6,
                                         `_str` =  `_str` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `s` = `s` - '.cost($user['_str']).' WHERE `id` = "'.$user['id'].'"');
      
      }

    }
    else
    if(value($user['_str'] == 'g')) {
      
      if($user['g'] < cost($user['_str'])) {
      
        
      
      }
      else
      {
      

          mysql_query('UPDATE `users` SET `str` =   `str` + 6,
                                         `_str` =  `_str` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `g` = `g` - '.cost($user['_str']).' WHERE `id` = "'.$user['id'].'"');
      
      }    
    
    }

}    
    header('location: /train.php');

}

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

if($user['_vit'] < 61) {

    if(value($user['_vit']) == 's') {

      if($user['s'] < cost($user['_vit'])) {
      
        
      
      }
      else
      {
      
          mysql_query('UPDATE `users` SET `vit` =   `vit` + 6,
                                         `_vit` =  `_vit` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `s` = `s` - '.cost($user['_vit']).' WHERE `id` = "'.$user['id'].'"');
      
      }

    }
    else
    if(value($user['_vit'] == 'g')) {
      
      if($user['g'] < cost($user['_vit'])) {
      
        
      
      }
      else
      {
      

          mysql_query('UPDATE `users` SET `vit` =   `vit` + 6,
                                         `_vit` =  `_vit` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `g` = `g` - '.cost($user['_vit']).' WHERE `id` = "'.$user['id'].'"');
      
      }    
    
    }

}    
    header('location: /train.php');

}

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

if($user['_agi'] < 61) {

    if(value($user['_agi']) == 's') {

      if($user['s'] < cost($user['_agi'])) {
      
        
      
      }
      else
      {
      
          mysql_query('UPDATE `users` SET `agi` =   `agi` + 6,
                                         `_agi` =  `_agi` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `s` = `s` - '.cost($user['_agi']).' WHERE `id` = "'.$user['id'].'"');
      
      }

    }
    else
    if(value($user['_agi'] == 'g')) {
      
      if($user['g'] < cost($user['_agi'])) {
      
        
      
      }
      else
      {
      

          mysql_query('UPDATE `users` SET `agi` =   `agi` + 6,
                                         `_agi` =  `_agi` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `g` = `g` - '.cost($user['_agi']).' WHERE `id` = "'.$user['id'].'"');
      
      }    
    
    }

}    
    header('location: /train.php');

}

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

if($user['_def'] < 61) {

    if(value($user['_def']) == 's') {

      if($user['s'] < cost($user['_def'])) {
      
        
      
      }
      else
      {
      
          mysql_query('UPDATE `users` SET `def` =   `def` + 6,
                                         `_def` =  `_def` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `s` = `s` - '.cost($user['_def']).' WHERE `id` = "'.$user['id'].'"');
      
      }

    }
    else
    if(value($user['_def'] == 'g')) {
      
      if($user['g'] < cost($user['_def'])) {
      
        
      
      }
      else
      {
      

          mysql_query('UPDATE `users` SET `def` =   `def` + 6,
                                         `_def` =  `_def` + 1,
                                        `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

            mysql_query('UPDATE `users` SET `g` = `g` - '.cost($user['_def']).' WHERE `id` = "'.$user['id'].'"');
      
      }    
    
    }

}    
    header('location: /train.php');

}

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

if($user['_mana'] < 61) {

    if(value($user['_mana']) == 's') {

      if($user['s'] < cost($user['_mana'])) {
      
        
      
      }
      else
      {
      
          mysql_query('UPDATE `users` SET `mana` =  `mana` + 5,
                                         `_mana` = `_mana` + 1,
                                         `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

      mysql_query('UPDATE `users` SET `s` = `s` - '.cost($user['_mana']).' WHERE `id` = "'.$user['id'].'"');
      
      }

    }
    else
    if(value($user['_mana'] == 'g')) {
      
      if($user['g'] < cost($user['_mana'])) {
      
        
      
      }
      else
      {
      

          mysql_query('UPDATE `users` SET `mana` =  `mana` + 5,
                                         `_mana` = `_mana` + 1,
                                         `skill` = `skill` + 1 WHERE `id` = "'.$user['id'].'"');

      mysql_query('UPDATE `users` SET `g` = `g` - '.cost($user['_mana']).' WHERE `id` = "'.$user['id'].'"');
      
      }    
    
    }

}    
    header('location: /train.php');

}

?>




</div></div><div class="title-top">Тренировочная площадь</div><div class="separ2"></div><div style="text-align:center;padding:3px" class="menu_link2"><div style="border:1px solid #131313;padding:1px;background:#232323;border-radius:3px;display:inline-block"><img src="http://213.239.195.28/xaos/style2/tren.jpg" alt="" style="border:1px solid #1b1b1b;border-radius:3px;"/></div></div><div class="separ"></div><div class="jour2"><div class="jour" style="padding:4px;font-size:14px;text-align:center;color:#a5a5a5;border:1px solid #090909;border-radius:3px">Отрабатывай свои умения и становись сильней!</div></div><div class="separ"></div><div class="menu_link3">
<?

  $_str_progress = round(100 / (60 / $user['_str']));

?>
<?

  if($user['_str'] < 60) {

?>
<table><tr><td style="width:52px;padding:4px"><img src="http://213.239.195.28/xaos/style2/st_att.png" alt=""/></td><td style="padding:4px"><div style="font-size:16px;">Сила</span><div style="color:#a5a5a5;font-size:14px;padding-bottom:2px">Уровень <?=$user['_str']?> из 130</div><a href="?str" class="mybutt_off">Тренировать +6 за <img src="/xaos/style2/<?=(value($user['_str']) == 'g' ? 'gold':'silver')?>.png" alt=""/> <?=(cost($user['_str']))?></a></td></tr></table></div><div class="menu_link3">
<?

}

?>
<?

  $_vit_progress = round(100 / (60 / $user['_vit']));

?>
<?

  if($user['_vit'] < 60) {

?>
<table><tr><td style="width:52px;padding:4px"><img src="http://213.239.195.28/xaos/style2/sw_hr.png" alt=""/></td><td style="padding:4px"><div style="font-size:16px;">Здоровье</span><div style="color:#a5a5a5;font-size:14px;padding-bottom:2px">Уровень <?=$user['_vit']?> из 130</div><a href="?vit" class="mybutt_off">Тренировать +6 за <img src="/xaos/style2/<?=(value($user['_vit']) == 'g' ? 'gold':'silver')?>.png" alt=""/> <?=(cost($user['_vit']))?></td></tr></table></div><div class="menu_link3">
<?

}

?>
<?

  $_def_progress = round(100 / (60 / $user['_def']));

?>

<?

  if($user['_def'] < 60) {

?>

<table><tr><td style="width:52px;padding:4px"><img src="http://213.239.195.28/xaos/style2/sw_sh.png" alt=""/></td><td style="padding:4px"><div style="font-size:16px;">Защита</span><div style="color:#a5a5a5;font-size:14px;padding-bottom:2px">Уровень <?=$user['_def']?> из 130</div><a href="?def" class="mybutt_off">Тренировать +6 за <img src="/xaos/style2/<?=(value($user['_def']) == 'g' ? 'gold':'silver')?>.png" alt=""/> <?=(cost($user['_def']))?></a></td></tr></table></div><div class="menu_link3"><table><tr><td style="width:52px;padding:4px"><img src="http://213.239.195.28/xaos/style2/sw_en.png" alt=""/>
<?

}

?>
<?

  $_mana_progress = round(100 / (60 / $user['_mana']));

?>
<?

  if($user['_mana'] < 60) {

?>
</td><td style="padding:4px"><div style="font-size:16px;">Энергия</span><div style="color:#a5a5a5;font-size:14px;padding-bottom:2px">Уровень <?=$user['_mana']?> из 130</div><a href="?mana" class="mybutt_off">Тренировать +5 за <img src="/xaos/style2/<?=(value($user['_mana']) == 'g' ? 'gold':'silver')?>.png" alt=""/> <?=(cost($user['_mana']))?></a>
<?

}

?>
</td></tr></table></div><div class="menu_link3"><table><tr><td style="width:52px;padding:4px"><img src="http://213.239.195.28/xaos/style2/sw_exp.png" alt=""/></td><td style="padding:4px"><div style="font-size:16px;">Опыт</span><div style="color:#a5a5a5;font-size:14px;padding-bottom:2px">Уровень <?=$user['_']?> из 130</div><a href="?" class="mybutt_off">Тренировать +0 за <img src="/xaos/style2/<?=(value($user['_']) == 'g' ? 'gold':'silver')?>.png" alt=""/> <?=(cost($user['_']))?></a></td></tr></table>
</div><div class="separ3"></div><div class="jour2"><div class="jour" style="padding:4px;font-size:14px;text-align:center;color:#a5a5a5;border:1px solid #090909;border-radius:3px">Тренировочный уровень: <?=$user['skill']?> / 550</div></div><div class="separ3"></div>





<?
  
include './system/f.php';

?>