$us=mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
$owntravma=mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = ".$us['id']." AND (type=13 OR type=12 OR type=14);"));
$raid_t=mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' limit 1;"));
$effect=mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '{$us['id']}' AND `time` > '".time()."' AND `type` = '227' LIMIT 1"));
$hm=mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'haos_match' LIMIT 1;"));
$hm=unserialize($hm['value']);
$us_b=mysql_fetch_array(mysql_query("SELECT `type`,`open` FROM `battle` WHERE `id`='{$us['battle']}';"));
$forb_battle=array();
if($raid_t['value']>0)
$forb_battle[]=$raid_t['value'];
foreach($hmas$lv=>$num)
if($num>0)
$forb_battle[]=$num;
if($user['intel']>0){
$int=90+$user['intel']*3;
if($int>98){$int=99;}
}
else{$int=91;}
if($user['battle']>0){
echo"Не в бою...";
}
elseif(!$us['online']){
echo"Персонаж не в игре!";
}elseif($us_b['type']==3||$us_b['type']==5){
echo"Запрещено входить в хаотический бой!";
}elseif($us['battle']>0&&$us_b['open']==0){
echo"Бой закрыт для вмешательства!";
}elseif(in_array($us['battle'],$forb_battle)){
echo"Вы не можете вступать в бой за силы Хаоса!!";
addchp('<font color=red>Внимание!</font> На вас '.$action.' <B>'.$user['login'].'</B>.<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ','{[]}'.nick::id($jert['id'])->short().'{[]}');
//mysql_query('UPDATE `logs` SET `log` = CONCAT(`log`,\'<span class=date>'.date("H:i").'</span> '.nick5($user['id'],"B".$ttt).' вмешался в поединок!<BR>\') WHERE `id` = '.$jert['battle'].'');
addlog($jert['battle'],'<span class=date>'.date("H:i").'</span> '.nick5($user['id'],"B".$ttt).' вмешался в поединок!<BR>');
mysql_query('UPDATE `battle` SET `teams` = \''.serialize($battle).'\', `t'.$ttt.'`=CONCAT(`t'.$ttt.'`,\';'.$user['id'].'\') WHERE `id` = '.$jert['battle'].' ;');
mysql_query("UPDATE users SET `battle` =".$jert['battle'].",`zayavka`=0 WHERE `id`= ".$user['id']);
addch("<a href=logs.php?log=".$id." target=_blank>Бой</a> между <B><b>".nick::id($user['id'])->short()."</b> и <b>".nick::id($jert['id'])->short()."</b> начался. ",$user['room']);