View file sdark.mobi/coliseum/fight.php

File size: 23.36Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
if($user['mesto']!='Бой'){header ("Location: ?");}
mysql_query("UPDATE `user` set `mesto` = 'Бой' where `id` = '".$user['id']."'");
$reqa = mysql_query("SELECT * FROM `coliseum` WHERE `usr` = '".$user['id']."' and `status`='1' and `fight`=''");
$avto = mysql_num_rows($reqa);
$coliseum = mysql_fetch_array($reqa);
if($avto==0){
	header ("Location: /coliseum/");
	exit;
	}
$header='Колизей';
require_once'../core/head.php';
$timer=$_SERVER['REQUEST_TIME']+300;
$kols = mysql_result(mysql_query("SELECT  COUNT(*)  FROM `coliseum` WHERE `battle`='".$coliseum['battle']."' and `usr`!='".$user['id']."' and `fight`=''"),0);
$ureq = mysql_query("SELECT * FROM `user` WHERE `id`='".$user['mob']."'");
$umob = mysql_fetch_array($ureq);
if($user['battle']==0 and $user['health']>0){
mysql_query("DELETE FROM `battle` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `duellog` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `link` WHERE `usr`='".$user['id']."'");
mysql_query("INSERT INTO `link` SET `usr`='".$user['id']."',`timer`='".$_SERVER['REQUEST_TIME']."'+'3600', `link`='".$_SERVER['PHP_SELF']."'");
mysql_query("UPDATE `user` set `mob` = '', `battle`='1' where `id` = '".$user['id']."'");
header ("Location: ?");exit;
}
if($user['battle']==0){
$_SESSION['err'] = ' Вы не находитесь в бою';
header ("Location: /");exit;}

if($kols==0){
$sug = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `wins` DESC LIMIT 0,1");
$ar = mysql_num_rows($sug);
$qw = mysql_fetch_array($sug);
if($ar>0){
mysql_query("UPDATE `coliseum` set `kak`='+',`rating`='5' WHERE `usr`='".$qw['usr']."' and `battle`='".$coliseum['battle']."'");
}
$sogg = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `wins` DESC LIMIT 1,2");
$arr = mysql_num_rows($sogg);
$qie = mysql_fetch_array($sogg);
if($arr>0){
mysql_query("UPDATE `coliseum` set `kak`='+',`rating`='2' WHERE `usr`='".$qie['usr']."' and `battle`='".$coliseum['battle']."'");
}
$syggg = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `wins` DESC LIMIT 2,3");
$amrr = mysql_num_rows($syggg);
$wer = mysql_fetch_array($syggg);
if($amrr>0){
mysql_query("UPDATE `coliseum` set `kak`='+',`rating`='0' WHERE `usr`='".$wer['usr']."' and `battle`='".$coliseum['battle']."'");
}

$sugggg = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `wins` DESC LIMIT 3,4");
$arrrr = mysql_num_rows($sugggg);
$qwert = mysql_fetch_array($sugggg);
if($arrrr>0){
mysql_query("UPDATE `coliseum` set `kak`='-',`rating`='1' WHERE `usr`='".$qwert['usr']."' and `battle`='".$coliseum['battle']."'");
}

$suggt = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `wins` DESC LIMIT 4,5");
$arrt = mysql_num_rows($suggt);
$arrti = mysql_fetch_array($suggt);
if($arrt>0){
mysql_query("UPDATE `coliseum` set `kak`='-',`rating`='3' WHERE `usr`='".$arrti['usr']."' and `battle`='".$coliseum['battle']."'");
}

$task = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='17'"));
if($task>0){
mysql_query("UPDATE `task` SET `min` = `min`+'1'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='17'");
}


mysql_query("UPDATE `coliseum` set `fight`='1' WHERE `usr`  = '".$user['id']."' and `battle`='".$coliseum['battle']."'");
header ("Location: /coliseum/");
exit;
}

if(isset($_GET['healing'])){
$reqx = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='healing'");
$healing = mysql_fetch_array($reqx);
$vrem = $_SERVER['REQUEST_TIME']+$healing['time'];
if($healing['timer']>''.$_SERVER['REQUEST_TIME'].'' or $user['health']<=0){$_SESSION['err']="Промах";
header ("Location: ?");exit;}
if($user['health']>=$user['max_health']){$_SESSION['err']="Лечение не требуется";
header ("Location: ?");exit;}else{
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$kolhp=$u*$healing['sila'];
$kolhp=round($kolhp,0);
mysql_query("UPDATE `umen` SET `timer` = '$vrem' WHERE `usr`='".$user['id']."' and `img`='healing'");
$xphe=$user['health']+$kolhp;
$um = mysql_num_rows(mysql_query("SELECT * FROM `bonus` WHERE `usr`='".$user['id']."' and `typ`='3'"));
if($um>0){$kolexp=$kolhp*2;}else{$kolexp=$kolhp;}
if($setgame['exp']==1)$kolexp=$kolexp*2;
if($xphe<=$user['max_health']){mysql_query("UPDATE `user` SET `health` = `health`+'".$kolhp."', `exp` = `exp`+'$kolexp' WHERE `id`='".$user['id']."'");}else{
mysql_query("UPDATE `user` SET `health` = '$user[max_health]', `exp` = `exp`+'".$kolhp."' WHERE `id`='".$user['id']."'");}
$_SESSION['message']="Вы использовали <img src='/images/umen/healing.png' height='16px' width='16px'> <font color='#FFBF00'>Исцеление</font> <img src='/images/icon/stat/hp.png'>+".$kolhp."";
header ("Location: ?");exit;
}}
if(isset($_GET['gift_of_the_Gods'])){
$reqxs = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='gift_of_the_Gods'");
$gift = mysql_fetch_array($reqxs);
$vrem = $_SERVER['REQUEST_TIME']+$gift['time']+30;
if($gift['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err']="Промах";
header ("Location: ?");exit;}
$umen = mysql_fetch_array(mysql_query("SELECT * FROM `umen` WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'"));
$dar=100*$umen['sila'];
mysql_query("INSERT INTO `bonus` set `usr` = ".$user['id'].", `name` = 'Дар Богов',`kol`='$dar',`param`='sila', `time` = '$vrem'-'$gift[time]', `bonus`='+$dar% к урону', `image`='14',`typ`='0'");
mysql_query("UPDATE `umen` SET `timer` = '$vrem' WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'");
$_SESSION['message']="Вы использовали <img src='/images/umen/gift_of_the_Gods.png' height='16px' width='16px'> <font color='#3B9CF6'>Дар Богов</font> +".$dar."% к урону";
header ("Location: ?");exit;}
if(isset($_GET['udar'])){
$ureq = mysql_query("SELECT * FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' and `fight`='' and `usr`!='".$user['id']."' and `usr`='".$id."'");
$mmc = mysql_fetch_array($ureq);
$mobca = mysql_query("SELECT * FROM `user` WHERE `id`='$mmc[usr]'");
$mobc = mysql_fetch_array($mobca);
if($mobc['plem']=='ogn'){$race2=0;}
if($mobc['plem']=='mol'){$race2=1;}

if(empty($id)){$_SESSION['err']="Не выбран противник";
header ("Location: ?");exit;}
if($mmc['fight']==1 or $user['health']<=0){
$_SESSION['err']="Промах";
header ("Location: ?");exit;}
$req = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack'");
$umen = mysql_fetch_array($req);
$summastat = $mobc['max_health']+$mobc['sila']+$mobc['zashit'];
$p=$mobc['zashit']/$summastat;
$y=1-$p;
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$udar=$u*$y;
if(isset($_GET['whack'])){$udar=$udar*$umen['sila'];}else{$udar=$u*$y;}
$udar=round($udar,0);
$dar = mysql_query("SELECT * FROM `bonus` WHERE `usr`='".$user['id']."' and `time`>'$tm' and `name`='Дар Богов'");
$adar=mysql_num_rows($dar);
$kdar=mysql_fetch_array($dar);
if($adar>0){
$kolik=$kdar['kol']/100;
$udar=floor($udar+($udar*$kolik));}
$uron=$mobc['health']-$udar;

$ool=$user['online']+300;
$sec=$timer-$ool;
if($sec<=0.8){
$_SESSION['err']="Промах";
header ("Location: ?");exit;}

if($udar>$user['max_uron']){mysql_query("UPDATE `user` SET `max_uron` = '".$udar."' WHERE `id`='".$user['id']."' LIMIT 1");}
$ttur=rand(1,4); 
if($ttur==1){$ttur='ударил'; }
if($ttur==2){$ttur='поразил';}
if($ttur==3){$ttur='сразил';}
if($ttur==4){$ttur='зацепил';}

$sms="$ttur";
if($uron<=0){
$ttud=rand(1,5);
if($ttud==1){$ttud='убил';}
if($ttud==2){$ttud='уничтожил';}
if($ttud==3){$ttud='разгромил';}
if($ttud==4){$ttud='сокрушил';}
if($ttud==5){$ttud='победил';}

$sart = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='18'"));
if($sart>0){mysql_query("UPDATE `task` SET `min` = `min`+'1'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='18'");}
 
mysql_query("UPDATE `user` SET `mob`='0', `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'2' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'2' WHERE `id`='$user[clan]'");
}
mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='".$mobc['id']."'");
if(isset($_GET['whack'])){
$vrem = $_SERVER['REQUEST_TIME']+$umen['time'];
if($umen['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err']="Промах";
header ("Location: ?");exit;}
mysql_query("UPDATE `umen` SET `timer` = '".$vrem."' WHERE `usr`='".$user['id']."' and `img`='whack'");
$_SESSION['light']="Вы использовали <img src='/images/umen/whack.png' height='16px' width='16px'> <font color='#FFBF00'>Сильный Удар</font> против <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`=' использовал <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильный Удар</font> против',`uron`='".$udar."',`timer`='".$timer."', `kogo`='".$mobc['id']."'");
}else{
$_SESSION['light']="Вы <img src='/images/icon/fight.png'>".$sms."и <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$sms."и ',opon='',uron='".$udar."',timer='".$timer."', `kogo`='".$mobc['id']."'");
}
$_SESSION['light']="Вы  <img src='/images/icon/dead.png'>".$ttud."и <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$ttud." ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='".$mobc['id']."'");
mysql_query("UPDATE `coliseum` set `fight`='1' WHERE `usr`  = '".$id."' and `battle`='".$coliseum['battle']."'");
mysql_query("UPDATE `coliseum` set `wins`=`wins`+'1', `exp`=`exp`+'".$udar."' WHERE `usr`  = '".$user['id']."' and `battle`='".$coliseum['battle']."'");
$_SESSION['message'] = ' Вы победили противника';
header ("Location: ?");exit;
}else{
if(isset($_GET['whack'])){
$vrem = $_SERVER['REQUEST_TIME']+$umen['time'];
if($umen['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;}
mysql_query("UPDATE `umen` SET `timer` = '".$vrem."' WHERE `usr`='".$user['id']."' and `img`='whack'");
$_SESSION['light']="Вы использовали <img src='/images/umen/whack.png' height='16px' width='16px'> <font color='#FFBF00'>Сильный Удар</font> против <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`=' использовал <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильный Удар</font> против',`uron`='".$udar."',`timer`='".$timer."', `kogo`='".$mobc['id']."'");
}else{
$_SESSION['light']="Вы <img src='/images/icon/fight.png'>".$sms."и <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$sms." ',opon='',uron='".$udar."',timer='".$timer."', `kogo`='".$mobc['id']."'");
} 
mysql_query("UPDATE `user` SET `health` = '".$uron."' WHERE `id`='".$mobc['id']."'");}
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$ttud." ',uron='".$udar."',timer='".$timer."',`kogo`='".$mobc['id']."'");
$ud = mysql_num_rows(mysql_query("SELECT * FROM `bonus` WHERE `usr`='".$user['id']."' and `typ`='3'"));
if($ud>0){$udar=$udar*2;}else{$udar=$udar;}
if($setgame['exp']==1)$udar=$udar*2;
mysql_query("UPDATE `coliseum` SET `exp` = `exp`+'".$udar."' WHERE `usr`='".$user['id']."' and `battle`='".$coliseum['battle']."'");
mysql_query("UPDATE `user` SET `exp` = '">$user['exp']."'+'".$udar."', `mob`='".$id."' WHERE `id`='".$user['id']."'");
header ("Location: ?");exit;
}


if($user['health']<=0){
echo"</div><div  class='but-list'>
<a href=\"?\"> <img src='/images/icon/reload.png'> Обновить </a></font>
<a href=\"/\"> <img src='/images/icon/error.png'> Покинуть бой </a></div></div>";
}else{
$avt = mysql_num_rows($ureq);
if($avt>0){
echo'<div class="foot"><table  width="100%">
<tbody>
<td class="center"><div class="empty2"></div> '.$umob['nick'].'<div class="empty2"></div>';
$kol70=100*0.70;
$kol30=100*0.30;
if($umob['hp']>=$kol70){$health="green";}
if($umob['hp']>=$kol30 and $umob['hp']<$kol70){$health="orange";}
if($umob['hp']<$kol30){$health="red";}
echo"<div class='hp'>
<div class='".$health."' style='width:".floor(100/($umob['max_health']/$umob['health']))."%'></div>
</div>";
echo'<div class="empty2"></div><div class="empty2"></div><font color="#CDC9C9"> ('.$umob['health'].'/'.$umob['max_health'].')</font></td>
</tbody></table></div><hr>
';}
echo"<div class='head'><table  width='100%' border='0' cellpadding='5px' cellspacing='0' style='padding-top: 5px;'>
<tbody>";
$randomob = mysql_fetch_array(mysql_query("SELECT  *  FROM `coliseum` WHERE `battle`='".$coliseum['battle']."' and `usr`!='".$user['id']."' and `fight`='' ORDER BY RAND() LIMIT 1"));
    
if($kols==0){echo'<td width="45%"><a class="fight center" href="?">  Обновить  </a></div></td>';}
if($kols==1 and $umob['health']>0){echo' <td width="45%"><a class="fight center" href="?udar&id='.$umob['id'].'">  Атаковать  </a></div></td>';}
if($kols==1 and $umob['health']<=0){echo' <td width="45%"><a class="fight center" href="?udar&id='.$randomob['usr'].'">  Атаковать  </a></div></td>';}
if($kols>1){
if($user['mob']>0 and $umob['health']>0){echo' <td width="45%"><a class="fight center" href="?udar&id='.$umob['id'].'">  Атаковать  </a></div></td>';}
echo' <td width="45%"><a class="fight center" href="?udar&id='.$randomob['usr'].'">  Бить любого  </a></div></td>';}
echo"</tbody></table><table  width='100%' border='0' cellpadding='1px' cellspacing='0' style='padding-top: 5px;'>
<tbody>";
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack' LIMIT 1");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto == 0){
echo"<td width='30%'><div class='big-but'><div class='imgwrap'><img src='/images/umen/whack_grey.png' height='20' width='20'></div><div class='empty'></div>Недоступно</td></div>"; 
} else {
if($umen['timer']<=$_SERVER['REQUEST_TIME']){
if($umob['hp'] > 0){
echo"<td width='30%'>
<a class='big-but' href=\"?udar&whack&id=".$randomob['usr']."\">
<div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'>
</div> 
<div class='empty'></div> 
</a>
</td>
</div>";
}
if($umob['hp'] <= 0){	
echo"<td width='30%'>
<a class='big-but' href=\"?udar&whack&id=".$randomob['usr']."\"><div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'>
</div> 
<div class='empty'>	</div> 
</a>
</td>
</div>";
} 
} else {
$recharge = $umen['timer'] - $_SERVER['REQUEST_TIME'];
echo"<td width='30%'><div class='big-but'><div class='imgwrap'><img src='/images/umen/whack_grey.png' height='20' width='20'></div>
<div class='empty'></div>".$recharge." сек</td>
</div>";
}
}
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='healing'");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/healing_grey.png" height="20" width="20"></div><div class="empty"></div>Недоступно</td></div>'; 
} else {
if($umen['timer'] <= $_SERVER['REQUEST_TIME']){
echo'<td width="30%"><a class="big-but" href=\'?healing\'><div class="imgwrap"><img src="/images/umen/healing.png" height="35" width="35"></div><div class="empty"></div></a></td></div>'; 
} else {
$recharge=$umen['timer']-$_SERVER['REQUEST_TIME'];
echo' <td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/healing_grey.png" height="20" width="20"></div>
<div class="empty"></div>'.$recharge.' сек</td>
</div>';
}
}
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='gift_of_the_Gods'");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods_grey.png" height="20" width="20"></div><div class="empty"></div>Недоступно</td></div>'; 
} else {
if($umen['timer'] <= $_SERVER['REQUEST_TIME']){
echo'<td width="30%"><a class="big-but" href=\'?gift_of_the_Gods\'><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods.png" height="35" width="35"></div><div class="empty"></div></a></td></div>'; 
} else {
$recharge=$umen['timer']-$_SERVER['REQUEST_TIME'];
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods_grey.png" height="20" width="20"></div>
<div class="empty"></div>'.$recharge.' сек</td>
</div>';
}
}

echo'</td></tbody></table></td>
</tbody>
</table><table width="100%" cellpadding="4px">
<tbody><tr><td width="30%">
<a class="inpc-ar center" href="?bottle=1"><div class="imgwrap"><img src="/images/icon/bottle/0.png">
</div> 
<div class="empty"></div> 
</a>
</td>
<td width="30%"><a class="inpc-ar center" href="?bottle=2"><div class="imgwrap"><img src="/images/icon/bottle/0.png"></div><div class="empty"></div></a></td>
<td width="30%"><a class="inpc-ar center" href="?bottle=3"><div class="imgwrap"><img src="/images/icon/bottle/0.png"></div><div class="empty"></div></a></td>
</tr></tbody>
</table>';
}
$requ = mysql_query("SELECT usr FROM `coliseum` WHERE `usr`!='".$user['id']."' and `status`='1' and `fight`='' and `battle`='".$coliseum['battle']."'");
$avto = mysql_num_rows($requ);
if($avto>0){
echo"</div><hr><div class='foot foot'><div class='center'>Противники</br><div class='empty2'></div></div>";
while($mob = mysql_fetch_array($requ)){
$randomobu = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='$mob[usr]'"));
$kol70=$randomobu['max_health']*0.7; 
$kol30=$randomobu['max_health']*0.3; 
if($randomobu['health']>=$kol70){$hp='<font color="green">'.$randomobu['health'].'</font>';}
if($randomobu['health']>=$kol30 and $randomobu['health']<$kol70){$hp='<font color="orange">'.$randomobu['health'].'</font>';}
if($randomobu['health']<$kol30){$hp='<font color="red">'.$randomobu['health'].'</font>';}
if($post['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";$color="#F7990D";}
if($post['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";$color="EBC621";}
if($post['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($post['prava']=="2"){$status="<font color='ffc22b'>[m]</font>";}
echo"<a class='fight' href='?udar&id=$randomobu[id]'>";
echo online($randomobu['id']);
echo"<font color='$randomobu[font]'> $randomobu[nick]</font>";
if($randomobu['prava']>"1"){echo" $status";}
 echo"<font color='grey'> ($hp)</font></a>";
}echo"</div>";}

$req = mysql_query("SELECT * FROM `duellog` WHERE (`kogo` = '".$user['id']."' and `del2`!='1')  and `timer`>='".$_SERVER['REQUEST_TIME']."' ORDER BY `id` DESC LIMIT 9");
$avto = mysql_num_rows($req);
if($user['plem']=='ogn'){$race=0;$pik='ogn';$race2=1;$pik2='mol';}
if($user['plem']=='mol'){$race=1;$pik='mol';$race2=0;$pik2='ogn';}
if($avto>=1){
echo"<hr><div class='foot foot'><div class='center'>Журнал боя</br><div class='empty2'></div></div>";
While($ilok = mysql_fetch_array($req)){
$timeudar=$_SERVER['REQUEST_TIME']-$ilok['timer']+300;
if($timeudar<60){
$timeudar="$timeudar сек.";
}else{
$timeudar=round($timeudar/60);
$timeudar="$timeudar мин.";
}
$fed = mysql_query("SELECT * FROM `user` WHERE `id` = '$ilok[kogo]'");
$us = mysql_fetch_array($fed);
$fe = mysql_query("SELECT * FROM `user` WHERE `nick` = '$ilok[usr]'");
$mu = mysql_fetch_array($fe);
if($mu['plem']=='ogn'){$plem='0';}
if($mu['plem']=='mol'){$plem='1';}
if($us['plem']=='ogn'){$plem2='0';}
if($us['plem']=='mol'){$plem2='1';}
if($mu['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";}
if($mu['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";}
if($mu['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($mu['prava']=="2"){$status="<font color='ffc22b'>[M]</font>";}

if($ilok['kogo']>0){
if($mu['plem']=='ogn'){$plem='0';}
if($mu['plem']=='mol'){$plem='1';}
if($user['clan']>0){$rate='<img src=/images/icon/rating_'.$race.'.png><font color="CDC9C9">+2</font>'; $rate2='<img src=/images/icon/rating_'.$race.'.png><font color="CDC9C9">+10</font>';}
if($ilok['dead']==1){echo '<img src="/images/icon/dead.png" height="16" width="16">
<font color="#AAAAAA"> <img src=/images/icon/race/'.$plem.'.png><a href="/user/'.$mu['id'].'/"><font color="'.$mu['font'].'">'.$mu['nick'].'</font>';
if($mu['prava'] > 1){echo' '.$status.'';}
echo'</a>  '.$ilok['text'].' <img src=/images/icon/race/'.$plem2.'.png><a href="/user/'.$us['id'].'/"><font color="'.$us['font'].'">'.$us['nick'].'</font>';
if($us['prava'] > 1){echo' '.$status2.'';} 
echo'</a></font> '.$rate.'<span class="mit">'.$timeudar.'</span>  <div class="empty"></div>';}else{
echo'<font color="#AAAAAA"> <img src=/images/icon/race/'.$plem.'.png><a href="/user/'.$mu['id'].'/"><font color="'.$mu['font'].'">'.$mu['nick'].'</font>';
if($mu['prava'] > 1){echo' '.$status.'';}
echo'</a> '.$ilok['text'].' <img src=/images/icon/race/'.$plem2.'.png><a href="/user/'.$us['id'].'/"><font color="'.$us['font'].'">'.$us['nick'].'</font>';
if($us['prava']>=2){echo' '.$status2.'';}echo'</a> на <font color="F5E17E">'.$ilok['uron'].'</font> урона</font><span class="mit">'.$timeudar.'</span>  <div class="empty"></div>';}}


}
}
echo"</div>";


echo"<hr><div class='foot center'>Статистика</br></div>";
$sur = mysql_query("SELECT usr,wins,exp FROM `coliseum` WHERE `status`='1' and `battle`='".$coliseum['battle']."' ORDER BY `exp` DESC LIMIT 0, 5");
$at = mysql_num_rows($sur);
if($at>0){
while($sn = mysql_fetch_array($sur)) {
$qst = mysql_query("SELECT id,nick,level,prava,font FROM `user` WHERE `id` = '".$sn['usr']."'");
$ust = mysql_fetch_array($qst);
echo"<hr><div class='but-list-light'>";
if($ust['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";$color="#F7990D";}
if($ust['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";$color="EBC621";}
if($ust['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($ust['prava']=="2"){$status="<font color='ffc22b'>[m]</font>";}
echo'<a href="/user/'.$ust['id'].'/">';
echo online($ust['id']);
echo '<font color="'.$ust['font'].'"> '.$ust['nick'].'</font>';
if($ust['prava'] > 1){echo' '.$status.'';}
echo', <img src="/images/icon/level.png">'.$ust['level'].'  <span class="float-right"> <img src="/images/icon/dead.png" width="16" height="16">'.$sn['wins'].', <img src="/images/icon/exp.png" width="16" height="16"> '.$sn['exp'].'</span></a></div>';
}
echo'</div>';}else{echo'<div class="foot">Список пуст</div>';}
require_once'../core/foot.php';
?>