Файл: b_oh_elic.php
Строк: 36
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$udata['id']."'");
$num=mysql_num_rows($bat);
if($num==0)
{
header('location: game.php');exit;
}
else
{
$bt=mysql_fetch_array($bat);
$lab=mysql_fetch_array(mysql_query("SELECT * FROM `labir` WHERE `id`='".$bt['labir']."'"));
$loka=mysql_fetch_array(mysql_query("SELECT * FROM `labir_loc_usr` WHERE `x`='".$bt['x']."' and `y`='".$bt['y']."' and `usr`='".$udata['id']."'"));
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `local_mob` WHERE `usr`='".$udata['id']."' and `id`='".$bt['enemy']."'"));
if($bt['status']==1 or $bt['status']==2)
{
header('location: b_oh.php');exit;
}
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$_GET['ef']."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: b_oh.php');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['tip']=='hp')
{
if($el['time']>time())
{
header('location: b_oh.php');exit;
}
else
{
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
header('location: b_oh.php');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `labir_usr` SET `hp`='".$hp."' WHERE `id`='".$bt['id']."'");
$elk=$el['kol']-1;
if($elk==0)
{
mysql_query("DELETE FROM `elic` WHERE `id`='".$el['id']."'");
}
else
{
$ds=date('d');
if($ds==8)
{
$el['rest']=round($el['rest']-$el['rest']/100*10);
}
$time=time()+$el['rest'];
mysql_query("UPDATE `elic` SET `kol`='".$elk."', `time`='".$time."' WHERE `id`='".$el['id']."'");
}
if($el['ef']!=20000)
{
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>'
");
}
else
{
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>'
");
}
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['elic_exp']+1;
mysql_query("UPDATE `users_dost` SET `elic_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
}
}
}
header('location: b_oh.php');exit;
?>