Файл: petas.php
Строк: 131
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
if($udata['lvl']<16)
{
header('location: game.php');exit;
}
if(isset($_GET['bye']))
{
$tr=mysql_query("SELECT * FROM `pits` WHERE `id`='".$_GET['bye']."'");
$num=mysql_num_rows($tr);
if($num==0)
{
header('location: ?');exit;
}
$t=mysql_fetch_array($tr);
if($t['cena']==250)
{
if($udata['money']<250)
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='У вас недостаточно средств на покупку этого питомца!'
");
header('location: ?');exit;
}
}
elseif($t['cena']==50)
{
if($udata['jem']<50)
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='У вас недостаточно средств на покупку этого питомца!'
");
header('location: ?');exit;
}
}
$trs=mysql_query("SELECT * FROM `pit` WHERE `usr`='".$udata['id']."'");
$nums=mysql_num_rows($trs);
if($nums==3)
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='Вы не можете держать более трех питомцев!'
");
header('location: ?');exit;
}
if($t['cena']==250)
{
$mon=$udata['money']-250;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($t['cena']==50)
{
$mon=$udata['jem']-50;
mysql_query("UPDATE `users` SET `jem`='".$mon."' WHERE `id`='".$udata['id']."'");
}
mysql_query("INSERT INTO `pit` SET
`id`='',
`usr`='".$udata['id']."',
`name`='".$t['name']."',
`tip`='".$t['tip']."',
`img`='".$t['img']."',
`lvl`='1',
`exp`='0',
`hp1`='".$t['hp']."',
`sila1`='".$t['sila']."',
`arm1`='".$t['arm']."',
`pred`='0',
`skill`='1',
`skill_up`='1'
");
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='Поздравляем с покупкой питомца!'
");
header('location: ?');exit;
}
$textl='Питомник';
include($path.'files/core.php');
$mobs1=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows1=mysql_num_rows($mobs1);
if($rows1!=0)
{
header('location: arena.php');exit;
}
$mobs2=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$rows2=mysql_num_rows($mobs2);
if($rows2!=0)
{
header('location: avan.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs4=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$udata['id']."'");
$rows4=mysql_num_rows($mobs4);
if($rows4!=0)
{
header('location: b_oh.php');exit;
}
$mobs5=mysql_query("SELECT * FROM `okrest` WHERE `usr`='".$udata['id']."'");
$rows5=mysql_num_rows($mobs5);
if($rows5!=0)
{
header('location: b_okr.php');exit;
}
$mobs6=mysql_query("SELECT * FROM `str_usr` WHERE `usr`='".$udata['id']."'");
$rows6=mysql_num_rows($mobs6);
if($rows6!=0)
{
header('location: b_str.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Питомник</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
echo '<div align=center><img src=img/inter/town1.png></div>';
echo '<div class="v4 p"><font color=#ff9900>Питомец, верный друг и надежный товарищ,
который поможет вам в ваших приключения!
</font></div>';
echo'</div>';
if(isset($_GET['info']))
{
$tr=mysql_query("SELECT * FROM `pits` WHERE `id`='".$_GET['info']."'");
$t=mysql_fetch_array($tr);
echo '<div class="v8"><div class="line bbs m bts brs bls b p v12">Питомец: '.$t['name'].'</div><div class="bat bts brs bls bbs p t3">';
echo'<img src=img/pit/'.$t['tip'].'/'.$t['img'].'.jpg width=45% alt='.$t['name'].' title='.$t['name'].'><br>
<img src=img/main/p21.png> Тип: ';
if($t['tip']==1)
{
echo'<font color=#ffff00>Тяжеловес</font>';
}
elseif($t['tip']==2)
{
echo'<font color=#ffff00>Ловкач</font>';
}
elseif($t['tip']==3)
{
echo'<font color=#ffff00>Паразит</font>';
}
elseif($t['tip']==4)
{
echo'<font color=#ffff00>Уникальный</font>';
}
echo'<br>
<img src=img/main/p21.png> Цена: ';
if($t['cena']==250)
{
echo'<img src=img/main/p5.png>'.$t['cena'].'<br>';
}
else
{
echo'<img src=img/main/p13.png>'.$t['cena'].'<br>';
}
echo'<img src=img/main/i25.png> <a href=?bye='.$t['id'].'><font color=#00cc00>Купить</font></a>';
echo'</div>';
echo '<div class="v8"><div class="line bbs m bts brs bls b p v12">Базовые Параметры</div><div class="bat bts brs bls bbs p t3">';
echo'<img src=img/main/p3.png> <font color=#999999>Живучесть</font>: <font color=#00ff00>'.$t['hp'].'</font><br>';
echo'<img src=img/main/p1.png> <font color=#999999>Сила</font>: <font color=#00ff00>'.$t['sila'].'</font><br>';
echo'<img src=img/main/p2.png> <font color=#999999>Броня</font>: <font color=#00ff00>'.$t['arm'].'</font><br>';
}
else
{
echo '<div class="v8"><div class="line m bbs bts brs bls b p v12">Тяжеловесы</div><div class="bat bts brs bls bbs p t1">';
$tr=mysql_query("SELECT * FROM `pits` WHERE `tip`='1' ORDER BY `id`");
while($t=mysql_fetch_array($tr))
{
echo'
<a href=?info='.$t['id'].'>
<img src=img/pit/'.$t['tip'].'/'.$t['img'].'.jpg width=32% alt='.$t['name'].' title='.$t['name'].'></a>
';
}
echo'</div>';
echo '<div class="v8"><div class="line m bbs bts brs bls b p v12">Ловкачи</div><div class="bat bts brs bls bbs p t1">';
$tr=mysql_query("SELECT * FROM `pits` WHERE `tip`='2' ORDER BY `id`");
while($t=mysql_fetch_array($tr))
{
echo'
<a href=?info='.$t['id'].'>
<img src=img/pit/'.$t['tip'].'/'.$t['img'].'.jpg width=32% alt='.$t['name'].' title='.$t['name'].'></a>
';
}
echo'</div>';
echo '<div class="v8"><div class="line m bbs bts brs bls b p v12">Паразиты</div><div class="bat bts brs bls bbs p t1">';
$tr=mysql_query("SELECT * FROM `pits` WHERE `tip`='3' ORDER BY `id`");
while($t=mysql_fetch_array($tr))
{
echo'
<a href=?info='.$t['id'].'>
<img src=img/pit/'.$t['tip'].'/'.$t['img'].'.jpg width=32% alt='.$t['name'].' title='.$t['name'].'></a>
';
}
echo'</div>';
echo '<div class="v8"><div class="line m bbs bts brs bls b p v12">Уникальные</div><div class="bat bts brs bls bbs p t1">';
$tr=mysql_query("SELECT * FROM `pits` WHERE `tip`='4' ORDER BY `id`");
while($t=mysql_fetch_array($tr))
{
echo'
<a href=?info='.$t['id'].'>
<img src=img/pit/'.$t['tip'].'/'.$t['img'].'.jpg width=32% alt='.$t['name'].' title='.$t['name'].'></a>
';
}
}
echo'</div>';
include('files/down.php');
?>