Файл: b_terr_elic.php
Строк: 54
<?
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 `terr_usr` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `terr_usr` WHERE `id`='".$bt['enemy']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."'"));
if($bts['tip']!='pit')
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
}
else
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$bts['pit']."'"));
$us['usr']=$us['name'];
}
if($bts['tip']!='pit')
{
if($us['ava']==0)
{
$img='<img src=img/pers/'.$us['klass'].''.$us['pol'].'.png>
';
}
else
{
$img='<img src=img/pers/ava/'.$us['ava'].'.png>';
}
$en_name=' <img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png><font color=#ff9900>'.$us['usr'].'</font>';
}
else
{
$us['usr']=$us['name'];
$en_name=' <font color=#ff9900>'.$us['usr'].'</font>';
$img= '<img src=img/pit/'.$us['tip'].'/'.$us['img'].'.jpg width=90px><br>';
}
$els=mysql_real_escape_string($_GET['elic']);
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$els."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: b_terr.php');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['time']>time())
{
$lg='<img src=img/main/e22.png> <font color=#999999>Зелье еще не готово.</font>';
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."',
`terr`='".$se['id']."'
");
header('location: b_terr.php');exit;
}
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
$lg='<img src=img/main/e22.png> <font color=#999999>нет эффекта.</font>';
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."',
`terr`='".$se['id']."'
");
header('location: b_terr.php');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `terr_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
{
$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_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>',
`terr`='".$se['id']."'
");
}
else
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>',
`terr`='".$se['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: b_terr.php');exit;
?>