Файл: shaman.php
Строк: 81
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');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 `okr_usr` 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;
}
if(isset($_GET['bye']))
{
$id=mysql_real_escape_string($_GET['bye']);
$saman=mysql_query("SELECT * FROM `shaman` WHERE `id`='".$id."'");
$num=mysql_num_rows($saman);
if($num!=0)
{
$sm=mysql_fetch_array($saman);
$si=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `tip`='".$sm['tip']."' and `usr`='".$udata['id']."'"));
if($si!=0)
{
mysql_query("INSERT INTO `user_log` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Ошибка.'
");
}
else
{
if($udata['money']<$sm['money'] or $udata['jem']<$sm['jem'])
{
mysql_query("INSERT INTO `user_log` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Недостаточно средств.'
");
}
else
{
$activ=mysql_query("SELECT * FROM `users_activ` WHERE `usr`='".$udata['id']."'");
$act=mysql_fetch_array($activ);
if($act['act_2']<1)
{
$kol=$act['act_2']+1;
mysql_query("UPDATE `users_activ` SET `act_2`='".$kol."' WHERE `usr`='".$udata['id']."'");
}
$mon=$udata['money']-$sm['money'];
$jem=$udata['jem']-$sm['jem'];
mysql_query("UPDATE `users` SET `money`='".$mon."', `jem`='".$jem."' WHERE `id`='".$udata['id']."'");
$tim=time()+(3600*24);
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='".$sm['tip']."',
`hp`='".$sm['hp']."',
`sila`='".$sm['sila']."',
`arm`='".$sm['arm']."',
`times`='".$tim."',
`item`='1',
`status`='on',
`img`='".$sm['img']."'
");
mysql_query("INSERT INTO `user_log` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Аура успешно активирована.'
");
if($udata['kv_d']==27)
{
$kol=$udata['kv_d_n']+1;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
}
}
}
header('location: ?');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<div class="v3 bts brs bls b p v12">Навигация</div><div class="v4 bts brs bls bbs p">
<img src=img/main/i26.png class="menu"> <a href=game.php>главная</a> / <a href=?>шаман</a>
</div>';
echo '<div class="v8"><div class="v3 bts brs bls b p v12">Шаман</div><div class="v2 bts brs bls bbs p t1">';
$saman=mysql_query("SELECT * FROM `shaman` ORDER BY `money` DESC, `jem` ASC");
while($sm=mysql_fetch_array($saman))
{
echo '<div class="v5 p v8">';
echo '<table>
<tr>
<td width=60px><img src=img/baf/'.htmlspecialchars($sm['img']).'.jpg></td>
<td><img src=img/main/e28.png><font color=#ff9900>'.$sm['name'].'</font><br>
<img src=img/main/e28.png> <font color=#00ff00><i>'.$sm['opis'].'</i></font><br>';
$si=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `tip`='".$sm['tip']."' and `usr`='".$udata['id']."'"));
if($si!=0)
{
$sis=mysql_fetch_array(mysql_query("SELECT * FROM `item` WHERE `tip`='".$sm['tip']."' and `usr`='".$udata['id']."'"));
echo '<img src=img/main/e30.png> <font color=#ff2222>Вы уже используете ауру данного типа. До конца: ';
$sek=$sis['times']-time();
$h=floor($sek/(60*60));
$m=floor(($sek % (60*60))/60);
$s=($sek % 60);
if($h!=0)
{echo $h.'ч ';}
if($m!=0)
{echo $m.'м ';}
if($s!=0)
{echo $s.'с ';}
echo '</font>';
}
else
{
echo '<img src=img/main/e30.png> <a href=?bye='.$sm['id'].'>Купить</a> за ';
if($sm['money']>0){echo '<img src=img/main/p5.png>'.$sm['money'].' ';}
if($sm['jem']>0){echo '<img src=img/main/p13.png>'.$sm['jem'].' ';}
}
echo'</td>
</tr>
</table>';
echo '</div>';
}
echo '</div></div>';
include('files/down.php');
?>