Файл: titwar.ru/pit/index.php
Строк: 47
<?
/* Питомцы by wap_masterok */
/* Специально для teowap.ru */
include_once '../system/common.php';
include_once '../system/functions.php';
include_once '../system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Pet';
include '../system/h.php';
$buy = isset($_REQUEST['buy']) ? abs(intval($_REQUEST['buy'])) : false;
if($buy){
$s = mysql_query('SELECT * FROM `pit_mag` WHERE `id` = "'.$buy.'"');
$s = mysql_fetch_array($s);
mysql_query("INSERT INTO `pit` SET `user_id`='".$user['id']."' , `pit_id`='".$buy."'");
mysql_query("UPDATE `users` SET `pit_id` = '".$buy."',`g` = `g`- 600 WHERE `id` = '$user[id]' LIMIT 1");
header('location: /pit/');
}
if(isset($_GET['buy'])){
$sql = mysql_query("SELECT * FROM `pit_mag` ORDER BY `id` DESC");
while ($row = mysql_fetch_assoc($sql))
{
echo " <div class='content'><img src='/pit/pet.png' alt='*'/> <br /><div class='list'> ".$row['name']." <img src='/images/icon/gold.png' alt='*'/> ".$row['cena']." <br /> <a href='?buy=".$row['id']."' style='display: block;' class='list a'>Купить</a></li></div></div>";
}
include_once '../system/f.php';
exit;
}
$sack = mysql_query('SELECT * FROM `pit` WHERE `user_id` = "'.$user['id'].'"');
$sack = mysql_fetch_array($sack);
$p = mysql_query('SELECT * FROM `pit_mag` WHERE `id` = "'.$user['pit_id'].'"');
$p = mysql_fetch_array($p);
if(!$sack){
echo "<div class='menu_link2'> You have no pet <a href='?buy' style='display: block;' class='list a'>Buy</a></div>";
}else{
echo " <div class='content'><img src='/pit/pet.png'> <br /><div class='list'> ".$sack['name']." <img src='/images/icon/str.png' alt='*'/> + ".$sack['sila']." | <img src='/images/icon/vit.png' alt='*'/> + ".$sack['heart']." | <img src='/images/icon/agi.png' alt='*'/> + ".$sack['ud']." | <img src='/images/icon/def.png' alt='*'/> + ".$sack['bron']." | <img src='/images/icon/mana.png' alt='*'/> + ".$sack['mana']." <br />
Уровень: ".$sack['level']."<br /> <a href='tren.php?id=".$sack['id']."' style='display: block;' class='list a'>Train</a></li></div></div>";
}
include_once '../system/f.php';
?>