$pohs=mysql_query("SELECT `owner`,`volna`,`id` FROM `hellround_pohod` WHERE `end` = 0;");
while($poh=mysql_fetch_array($pohs)){
// проверяем на живность
$u=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id` = '".$poh['owner']."' LIMIT 1;"));
if($u['hp']<=0){
// удаляем ресурсы
mysql_query("DELETE FROM `inventory` WHERE `owner` = '".$poh['owner']."' AND `bs` = 1;");
mysql_query("UPDATE `hellround_pohod` SET `end` = 1, `date_out` = NOW( ) WHERE `id` = ".$poh['id']." AND `end` = 0;");
addchp('<font color=red>Внимание!</font> Вы погибли в противостоянии хаосу...<BR>\'; top.frames[\'main\'].location=\'main.php\'; var z = \' ','{[]}'.nick7($poh['owner']).'{[]}');
echo"USER: ".$poh['owner']." live trip.\n";
}else
{
// забираем последний бой, может пора запускать волну?
$last_a=mysql_fetch_array(mysql_query("SELECT `id` FROM `battle` WHERE `t1` = '".$poh['owner']."' AND `win` = 3 ORDER by `id` DESC LIMIT 1;"));
$last_b=mysql_fetch_array(mysql_query("SELECT `to1` FROM `battle` WHERE `t1` = '".$poh['owner']."' AND `win` <> 3 ORDER by `id` DESC LIMIT 1;"));
addlog($id,"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда <b>".nick::id($poh['owner'])->full(1)."</b> вышел на битву с Адом... <BR>");
mysql_query("UPDATE users SET `battle` =".$id.",`zayavka`=0 WHERE `id`= ".$poh['owner'].";");
addchp('<font color=red>Внимание!</font> Новое пришествие...<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ','{[]}'.nick7($poh['owner']).'{[]}');
mysql_query("UPDATE `hellround_pohod` SET `volna`=`volna`+1 WHERE `id` = ".$poh['id']." LIMIT 1;");