Файл: titwar.ru/pit/tren.php
Строк: 42
<?
include_once '../system/common.php';
include_once '../system/functions.php';
include_once '../system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Training';
include '../system/h.php';
$s = mysql_query('SELECT * FROM `pit` WHERE `user_id` = "'.$user['id'].'"');
$s = mysql_fetch_array($s);
$sp = mysql_query('SELECT * FROM `pit_mag` WHERE `id` = "'.$user['pit_id'].'"');
$sp = mysql_fetch_array($sp);
$cena=$s['level']*500;
if(isset($_GET['ok']) && $user['g']>=$cena){
mysql_query("UPDATE `pit` SET `sila`=`sila`+'50',`heart`=`heart`+'50',`ud`=`ud`+'50',`bron`=`bron`+'50',`mana`=`mana`+'50',`level`=`level`+'1' WHERE `user_id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `g`=`g`-'".$cena."',`str`=`str`+'50',`vit`=`vit`+'50',`agi`=`agi`+'50',`def`=`def`+'50',`mana`=`mana`+'50' WHERE `id`='".$user['id']."'");
header('location: /pit/');
}
echo '<div class="content"><img src="/pit/pet.png" alt="*"/><br /> Price of pet training '.$cena.' <img src="/images/icon/gold.png" alt="*"/><br /> </div>';
echo '<div class="content"> After training you and your pet will get +50 to all stats for each level <br />
<a href="tren.php?id='.$id.'&ok" class="button">Train</a><br />
</div>';
include_once '../system/f.php';
?>