Файл: titans.bdls.ru/pets/pets.php
Строк: 40
<?php
include '../system/common.php';
include '../system/functions.php';
include '../system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Мой питомец';
include ('../system/h.php');
$pets = mysql_query("SELECT * FROM `pets_user` WHERE `user`='".$user['id']."'");
if(mysql_num_rows($pets) == '0'){
echo '<div class="main block">У Вас не питомца!</div>
<div class="main menuList"><li><a href="/pets/pets_buy.php"><img src="/images/icon/arrow.png"> Купить питомца</a></li></div>';
}else{
$mypets = mysql_fetch_assoc(mysql_query("SELECT * FROM `pets_user` WHERE `user` = '".$user['id']."'"));
?>
<?
if($_GET['act'] == hp && $mypets['hp'] < $mypets['max_hp'] && $user['g'] >= 100) {
mysql_query("update `pets_user` set `hp` = '".$mypets['max_hp']."' where `user` = '".$user['id']."'");
mysql_query("update `users` set `g` = `g` - 100 where `id` = '".$user['id']."'");
header('location: ?');
exit();
}
?>
<?
if($_GET['act'] == del) {
mysql_query("update `pets_user` set `user` = 0 where `user` = '".$user['id']."'");
header('location: ?');
exit();
}
?>
<div class="main block center"><img src="/images/pets/<?=$mypets['img'];?>.png" height="100" width="80"></div>
<div class="main block"><b> <?=$mypets['name'];?></b></br><img src="/images/icon/str.png"> Сила: <?=$mypets['sila'];?></br>
<img src="/images/icon/def.png"> Защита: <?=$mypets['def'];?></br>
<img src="/images/icon/vit.png"> Здоровье: <?=$mypets['hp'];?>/<?=$mypets['max_hp'];?></div>
<div class="menuList main">
<?
if($mypets['hp'] < $mypets['max_hp']) {
?>
<li><a href="?act=hp"> <img src="/images/icon/arrow.png"> Восстановить здоровье 100 <img src="/images/icon/gold.png"></a></li>
<?
}
?>
<li><a href="/pets/train.php"> <img src="/images/icon/arrow.png"> Тренировать</a></li>
<li><a href="?act=del"> <img src="/images/icon/arrow.png"> Отпустить</a></li>
</div>
<?
}
require_once ('../system/f.php');
?>