Файл: pdz_bt_elic.php
Строк: 37
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bt=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_usr` WHERE `usr`='".$udata['id']."'"));
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_mob` WHERE `id`='".$bt['enemy']."'"));
$bts_num=mysql_num_rows(mysql_query("SELECT * FROM `pdz_mob` WHERE `id`='".$bt['enemy']."'"));
$en_name='<font color=#ff9900>'.$bts['name'].'</font>';
if($bt['status']==1 or $bt['status']==2)
{
header('location: pdz_bt.php');exit;
}
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$_GET['elic']."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: pdz_bt.php');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['tip']=='hp')
{
if($el['time']>time())
{
header('location: pdz_bt.php');exit;
}
else
{
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
header('location: pdz_bt.php');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `pdz_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_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>',
`pdz`='".$pdz_kom['id']."'
");
}
else
{
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>',
`pdz`='".$pdz_kom['id']."'
");
}
$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: pdz_bt.php');exit;
?>