<?
session_start();
if(empty($login)){
print "<script>top.location.href='index.html';</script>";
}
include "conf.php";
include "functions.php";
if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$boy) or ereg("[<>\\/-]",$battle_type) or ereg("[<>\\/-]",$timeout) or ereg("[<>\\/-]",$log) or ereg("[<>\\/-]",$ac)
 or ereg("[<>\\/-]",$denie) or ereg("[<>\\/-]",$accept) or ereg("[<>\\/-]",$accept2) or ereg("[<>\\/-]",$otkaz) or ereg("[<>\\/-]",$id)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$boy=htmlspecialchars($boy);
$battle_type=htmlspecialchars($battle_type);
$timeout=htmlspecialchars($timeout);
$log=htmlspecialchars($log);
$ac=htmlspecialchars($ac);
$accept=htmlspecialchars($accept);
$accept2=htmlspecialchars($accept2);
$otkaz=htmlspecialchars($otkaz);
$id=htmlspecialchars($id);
$denie=htmlspecialchars($denie);
$data = mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name,$data);
$S = mysql_query("SELECT * FROM users WHERE login='$login'");
$db = mysql_fetch_array($S);
$orden = $db["orden"];
$orden_d = $db["orden"];
$clan_s  = $db["clan_short"];
$clan_f  = $db["clan"];
$travm   = $db["travm"];
$level   = $db["level"];
$room   = $db["room"];
$rang = $db["rang"];

	if($travm!=0){
	$travm_i = "<img src='img/travma2.gif' alt='Персонаж поврежден'>";
	}
	else{$travm_i="";}

	if($orden_d==1){$orden_dis="Белое братство";}
	else if($orden_d==2){$orden_dis="Темное братство";}
	else if($orden_d==3){$orden_dis="Нейтральное братство";}
	else if($orden_d==4){$orden_dis="Алхимик";}
	else if($orden_d==5){$orden_dis="Тюремный заключеный";}
	if(empty($clan_s)){$clan="";}
	else{$clan="<img src='img/clan/$clan_s.gif' border=0 alt='$clan_f'>";}
	if(empty($orden_d)){$orden="";}
	else{
if ($orden_d==2) {$orden="<img src='img/orden/arm/$rang.gif' width=12 height=15 border=0 alt='$orden_dis'>";} 
else{$orden="<img src='img/orden/$orden_d.gif' border=0 alt='$orden_dis'>";}
if ($orden_d==1) {$orden="<img src='img/orden/pal/$rang.gif' width=12 height=15 border=0 alt='$orden_dis'>";} }

?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="ru">
<META HTTP-EQUIV="Refresh" CONTENT="30"; URL="zayavka.php">
<LINK REL=StyleSheet HREF='style.css' TYPE='text/css'>
<title>АнтиБК+</title>
</head>

<BODY bgColor=#e2e0e0 leftMargin=5 topMargin=5 marginheight="5" marginwidth="5">


<?
$data = mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name,$data);
$sql = "SELECT * FROM users WHERE login='$login'";
$result = mysql_query($sql);
$db = mysql_fetch_array($result);

$LOOK_MINE = mysql_query("SELECT login FROM miners");
    while($LOOK_M = mysql_fetch_array($LOOK_MINE)){
     if($LOOK_M["login"] == $login){
      print "Вы добываете ресурсы. Вы не можете драться сейчас.";
      die();
     }
    }


$cure_hp=$db["cure_hp"];
$cure_mn=$db["cure_mn"];
$time_to_cure=$cure_hp-time();
$hhh=$db["hp_all"];
if($db["battle"]==0){
if($time_to_cure>0){
$percent_hp=floor((100*$time_to_cure)/1200);
$percent=100-$percent_hp;
$percent=$percent;
$hp[0]=floor(($hhh*$percent)/100);
$sss="UPDATE users SET hp='$hp[0]' WHERE login='$login'";
$q=mysql_query($sss);
}
else{
$hp[0]=$db["hp_all"];
$SS = mysql_query("UPDATE users SET hp='$hp[0]',cure_hp='0' WHERE login='$login'");
$time_to_cure_f=0;
}
}








$MINE1 = mysql_query("SELECT * FROM team1");
$MINE2 = mysql_query("SELECT * FROM team2");

$m = 0;

while($MD1 = mysql_fetch_array($MINE1)){
        if($MD1["player"] == $login){
        $m = $MD1["battle_id"];
        $SS = mysql_query("SELECT * FROM team2 WHERE battle_id=$m");
        $DD = mysql_fetch_array($SS);
        $opponent = $DD["player"];
        $pl1 = str_replace(" ","%20",$opponent);
        $t = 1;
        }
}
while($MD2 = mysql_fetch_array($MINE2)){
        if($MD2["player"] == $login){
        $m = $MD2["battle_id"];
        $SS = mysql_query("SELECT * FROM team1 WHERE battle_id=$m");
        $DD = mysql_fetch_array($SS);
        $opponent = $DD["player"];
        $pl1 = str_replace(" ","%20",$opponent);
        $t = 2;
        }
}

$SQL   = "SELECT * FROM zayavka";
$QUERY = mysql_query($SQL);
while($DAT=mysql_fetch_array($QUERY)){

        $cr = $DAT["creator"];
        $SP = mysql_query("SELECT login FROM users WHERE id=$cr");
        $SPD = mysql_fetch_array($SP);
        $player = $SPD["login"];

        $city_game=$db["city_game"];
        $online = 0;

        $SEARCH = mysql_query("SELECT * FROM online WHERE login = '$player'");

        if(mysql_fetch_array($SEARCH)){$online = 1;}

        if($online == 0){
        $DEL = mysql_query("DELETE FROM zayavka WHERE creator=$cr");
        $DEL1 = mysql_query("DELETE FROM team1 WHERE battle_id=$cr");
        $DEL2 = mysql_query("DELETE FROM team2 WHERE battle_id=$cr");
        }

        if($m == $DAT["creator"] AND $DAT["status"]==1){$zayavka_status="awaiting";}
        if($m == $DAT["creator"] AND $DAT["status"]==2 AND $t == 1){$zayavka_status="confirm_mine";}
        if($m == $DAT["creator"] AND $DAT["status"]==2 AND $t == 2){$zayavka_status="confirm_opp";}
        if($m == $DAT["creator"] AND $DAT["status"]==3){goBattle($login);}
}




if(empty($boy) or $boy=="none"){
?>
<html>

<div align="left">
<table align=center width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align=left valign=middle width=50%>
<b><font size="2">
<? showHP($login); ?>
</font></b>
</td>
    <td  align=right valign=middle><input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
<input type=button value="Вернуться" onclick="javascript:location.href='main.php?act=none'">
</td>
  </tr>
</table>
<table align=center cellSpacing=1 cellPadding=1 width="100%">
  <tr>
  
<?if($room == "Зал войнов" or $room == "Зал войнов 2" or $room == "Зал войнов 3" or $room == "Будуар"){  
print"<TD class=m width=40>&nbsp;<B>Бои:</B></TD>
<TD class=m><A href=\"zayavka.php?boy=phisic\" class=nick>Физические</A></TD>
<TD class=m><A href=\"boy_bot.php\" class=nick>С ботом</A></TD>
<TD class=m><A href=\"group_zayavka.php\" class=nick>Групповые</A></TD>
<TD class=m><A href=\"during.php\" class=nick>Текущие</A></TD>
<TD class=m><A href=\"archive.php\" class=nick>Завершенные</A></TD>


  </tr>
</table>
<br><br>
<center><b>Выберите раздел</b></center>

</html>";
}
else {
print"<TD class=m width=40>&nbsp;<B>Бои:</B></TD>
<TD class=m><A href=\"#\" class=nick>Физические</A></TD>
<TD class=m><A href=\"#\" class=nick>С ботом</A></TD>
<TD class=m><A href=\"#\" class=nick>Групповые</A></TD>
<TD class=m><A href=\"#\" class=nick>Текущие</A></TD>
<TD class=m><A href=\"#\" class=nick>Завершенные</A></TD>

  </tr>
</table>
<br><br>
<center><b>Бои проводятся только в залах Бойцовского клуба!</b></center>

</html>";
die();}

die();
}
if(empty($zayavka_status)){
$zayavka_status="no";}
if(empty($act)){
$act="";
}
 ?><html>

<table align=center width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align=left valign=middle width=50%>
<b><font size="2">
<? showHP($login); ?>
</font></b>
</td>
    <td  align=right valign=middle><input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
<input type=button value="Вернуться" onclick="javascript:location.href='main.php?act=none'">

</td>
  </tr>
</table>
<table align=center cellSpacing=1 cellPadding=1 width="100%">
  <tr>
  
<?if($room == "Зал войнов" or $room == "Зал войнов 2" or $room == "Зал войнов 3" or $room == "Будуар"){  
print"<TD class=m width=40>&nbsp;<B>Бои:</B></TD>
<TD class=s><A href=\"zayavka.php?boy=phisic\" class=nick>Физические</A></TD>
<TD class=m><A href=\"boy_bot.php\" class=nick>С ботом</A></TD>
<TD class=m><A href=\"group_zayavka.php\" class=nick>Групповые</A></TD>
<TD class=m><A href=\"during.php\" class=nick>Текущие</A></TD>
<TD class=m><A href=\"archive.php\" class=nick>Завершенные</A></TD>

  </tr>
</table>";
}
else {
print"<TD class=m width=40>&nbsp;<B>Бои:</B></TD>
<TD class=m><A href=\"#\" class=nick>Физические</A></TD>
<TD class=m><A href=\"#\" class=nick>С ботом</A></TD>
<TD class=m><A href=\"#\" class=nick>Групповые</A></TD>
<TD class=m><A href=\"#\" class=nick>Текущие</A></TD>
<TD class=m><A href=\"#\" class=nick>Завершенные</A></TD>

  </tr>
</table>
<br><br>
<center><b>Бои проводятся только в залах Бойцовского клуба!</b></center>

</html>";
die();}
?>
<?php
/*======подать заявку====================================*/
if($act=="podat"){

/*=====status disc=========*/
/*1 - ожидает вызова       */
/*2 - ожидает подтверждения*/
/*3 - принята              */
/*=========================*/

 if($db["hp_all"]/3 > $db["hp"]){
 print "Вы слишком ослаблены для поединка! Восстановитесь!<BR>";
 print "<a href=\"javascript:history.back(-1)\" class=us2>назад</a>";
 die();
 }

$ST1=mysql_query('SELECT * FROM team1');
        while($dat=mysql_fetch_array($ST1)){
                if($dat["player"]==$login){
                print "Вы не можете принять эту заявку! Сначала отзовите свою!<BR>";
                print "<a href='zayavka.php?boy=phisic' class=us2>назад</a>";
                die();
                }
        }
$ST2=mysql_query('SELECT * FROM team2');
        while($dat=mysql_fetch_array($ST2)){
                if($dat["player"]==$login){
                print "Вы не можете принять эту заявку! Сначала отзовите свою!<BR>";
                print "<a href='zayavka.php?boy=phisic' class=us2>назад</a>";
                die();
                }
        }

if(empty($ip))
{
               if (getenv('HTTP_X_FORWARDED_FOR'))
                {
                        $ip=getenv('HTTP_X_FORWARDED_FOR');
                }
                       else
                {
                        $ip=getenv('REMOTE_ADDR');
                }
}

$date=date("d.m.Y H:i");

$time=date("H:i");
$mine_id=$db["id"];

$SQL="INSERT INTO zayavka(status,type,date,timeout,creator) VALUES('1','$battle_type','$time','$timeout','$mine_id')";
$QUERY=mysql_query($SQL);
$SQL2 = mysql_query("INSERT INTO team1(player,ip,battle_id,hitted,over) VALUES('$login','$ip','$mine_id','0','0')");
$S11 = mysql_query("UPDATE users SET zayavka='1' WHERE login='$login'");
$zayavka_c_m = 0;
session_register('zayavka_c_m');
print "<script>location.href='zayavka.php?boy=phisic'</script>";

}
/*=======================================================*/
/*======принять вызов====================================*/
if($act=="a"){

 if($db["hp_all"]/3 > $db["hp"]){
 print "Вы слишком ослаблены для поединка! Восстановитесь!<BR>";
 print "<a href=\"javascript:history.back(-1)\" class=us2>назад</a>";
 die();
 }

$Q_TEAM1=mysql_query("SELECT * FROM team1 WHERE player='$login'");
$Q_TEAM2=mysql_query("SELECT * FROM team2 WHERE player='$login'");
while($D1=mysql_fetch_array($Q_TEAM1)){
        if($D1["player"]==$login){
        print "Вы не можете принять этот вызов!Сначала отзовите свою заявку.<BR>";
        print "<a href='zayavka.php?boy=phisic' class=us2>Вернуться</a>";
        die();
        }
}
while($D2=mysql_fetch_array($Q_TEAM2)){
        if($D2["player"]==$login){
        print "Вы не можете принять этот вызов!Сначала отзовите свою заявку.<BR>";
        print "<a href='zayavka.php?boy=phisic' class=us2>Вернуться</a>";
        die();
        }
}

$S="SELECT * FROM zayavka WHERE creator=$id";
$Q=mysql_query($S);
if(empty($ip))
{
               if (getenv('HTTP_X_FORWARDED_FOR'))
                {
                        $ip=getenv('HTTP_X_FORWARDED_FOR');
                }
                       else
                {
                        $ip=getenv('REMOTE_ADDR');
                }
}
        if($Q){


    $zayavka_c_o = 0;
    session_register('zayavka_c_o');

        $data=mysql_fetch_array($Q);
        $SEEK = mysql_query("SELECT * FROM team2 WHERE battle_id = $id");
        $D2 = mysql_fetch_array($SEEK);
        $SDK = mysql_query("SELECT * FROM team1 WHERE battle_id = $id");
        $d = mysql_fetch_array($SDK);
                if($D2["player"]=='' OR empty($D2["player"])){
                $SQL=mysql_query("INSERT INTO team2(player,ip,battle_id,hitted,over) VALUES('$login','$ip','$id','0','0')");
                $QQQ = mysql_query("UPDATE zayavka SET status='2' WHERE creator = $id");
                        if($SQL){
                        $S11 = mysql_query("UPDATE users SET zayavka='1' WHERE login='".$d["player"]."'");
                        print "<script>location.href='zayavka.php?boy=phisic'</script>";
                        }
                }
        }
}
/*======================================================*/
/*=====отозвать заявку==================================*/
if($act=="recall"){
$S=mysql_query("SELECT * FROM team1 WHERE player='$login'");
        if($S){
        $DDD = mysql_query("SELECT status FROM zayavka WHERE creator='$cr'");
        $DD = mysql_fetch_array($DDD);
                if($DD["status"]!=2){
                $DDD = mysql_fetch_array($S);
                $cr = $DDD["battle_id"];
                $SQL="DELETE FROM zayavka WHERE creator='$cr'";
                $S2 = mysql_query("DELETE FROM team1 WHERE battle_id=$cr");
                $QUERY=mysql_query($SQL);
                        if($QUERY){
                        $S11 = mysql_query("UPDATE users SET zayavka='0' WHERE login='$login'");
                        print "<script>location.href='zayavka.php?boy=phisic'</script>";
                        }
                }
        }
}
/*=====================================================*/
/*=========отозвать свою заявку========================*/
if($act=="recallBattle"){
$S="SELECT * FROM team2 WHERE player='$login'";
$Q=mysql_query($S);
        if($Q){
        $DATA=mysql_fetch_array($Q);
        $cr=$DATA["battle_id"];
        $DDD = mysql_query("SELECT status FROM zayavka WHERE creator='$cr'");
        $DD = mysql_fetch_array($DDD);
                if($DD["status"]!=3){
                $SQL="UPDATE zayavka SET status='1' WHERE creator='$cr'";
                $QUERY=mysql_query($SQL);
                $SSD = mysql_query("DELETE FROM team2 WHERE battle_id=$cr");
                        if($QUERY){
                        $SSS = mysql_query("SELECT * FROM team1 WHERE battle_id=$cr");
                        $DDD = mysql_fetch_array($SSS);
                        $p = $DDD["player"];
                        $S11 = mysql_query("UPDATE users SET zayavka='0' WHERE login='$p'");
                        print "<script>location.href='zayavka.php?boy=phisic'</script>";
                        }
                }
        }
}
/*=====================================================*/
/*===============confirm===============================*/
if($act=="confirm"){
        if($denie){
        $S=mysql_query("SELECT * FROM team1 WHERE player='$login'");
        if($S){
        $DATA=mysql_fetch_array($S);
        $cr = $DATA["battle_id"];
        $SQL="UPDATE zayavka SET status='1' WHERE creator=$cr";
        $QUERY=mysql_query($SQL);
        $SSS = mysql_query("SELECT * FROM team2 WHERE battle_id=$cr");
        $DDD = mysql_fetch_array($SSS);
        $S2 = mysql_query("DELETE FROM team2 WHERE battle_id=$cr");
                if($QUERY){
        $_SESSION["zayavka_c_m"] = 0;


                $op = $DDD["player"];
                $S11 = mysql_query("UPDATE users SET zayavka='0' WHERE login='$op'");
                print "<script>location.href='zayavka.php?boy=phisic'</script>";
                }
        }
        }
        if($accept){
        $SQL   = "SELECT * FROM team1 WHERE player='$login'";
        $QUERY = mysql_query($SQL);
                if($QUERY){
                $DATA = mysql_fetch_array($QUERY);
                $tt = $DATA["type"];
                $cr = $DATA["battle_id"];
                $ZZ = mysql_query("SELECT player FROM team2 WHERE battle_id=$cr");
                        if($ZZ = mysql_fetch_array($ZZ)){
                        $S  = "INSERT INTO battles(type,status,creator_id) VALUES('$tt','during','$cr')";
                        $Q  = mysql_query($S);
                                if($Q){
                                $SSS = mysql_query("SELECT * FROM team2 WHERE battle_id=$cr");
                                $DDD = mysql_fetch_array($SSS);
                                $op = $DDD["player"];
                                $SQL_RM   = mysql_query("UPDATE zayavka SET status='3' WHERE creator=$cr");
                                $S1 = mysql_query("UPDATE users SET zayavka='2' WHERE login='$login'");
                                $S11 = mysql_query("UPDATE users SET zayavka='2' WHERE login='$op'");
                                goBattle($login);
                                }
                        }
                        else{
                        }
                }
        }
}
/*=====================================================*/
if($zayavka_status=="no"){
?>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=50% align=left valign=top>
<form name="boy" action="zayavka.php?boy=phisic&act=podat" method="POST">
<TABLE cellSpacing=0 cellPadding=0>
        <TBODY>
        <TR>
          <TD><form name="boy" action="zayavka.php?boy=phisic&act=podat" method="POST">
            <FIELDSET><LEGEND><B>Подать заявку на бой</B> </LEGEND>Таймаут 
            <SELECT name=timeout><OPTION value=3>3 мин.<OPTION value=4>4 
              мин.<OPTION value=5>5 мин.<OPTION value=7>7 мин.<OPTION value=10 
              selected>10 мин.</OPTION></SELECT> Тип боя <SELECT name=battle_type><OPTION 
              value=1 selected>с оружием<OPTION value=2>кулачный</OPTION></SELECT> 
<INPUT type=submit value="Подать заявку">&nbsp; 
            </FIELDSET></form> </TD></TR></TBODY></TABLE>

 </td><td align=right valign=top>
<input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
</td></tr></table>
<?
}
else if($zayavka_status=="awaiting"){
?>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=50% align=left valign=top>

<form name="otziv" action="zayavka.php?boy=phisic&act=recall" method="POST">
Вы уже подали заявку на бой.
<input type=hidden name="otziv" value="1">
<input type=submit value="Отозвать заявку">

</form>
</td><td align=right valign=top>
<input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
</td></tr></table>
<?
}
else if($zayavka_status=="confirm_mine"){
$OPP_SQL="SELECT * FROM users WHERE login='$opponent'";
$OPP_QUERY=mysql_query($OPP_SQL);
$OPP_DATA=mysql_fetch_array($OPP_QUERY);
$op_level=$OPP_DATA["level"];
?>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=100% align=left valign=top>
<table border=0 width=100%><tr><td>
<form name="accept" action="zayavka.php?boy=phisic&act=confirm" method="POST">
<font color=red><b>Персонаж </b></font><?print "<b>$opponent</b> [$op_level]<a href='info.php?log=$pl1' target=_new><img src='img/inf.gif' border=0 alt='Информация о персонаже $opponent'></a>";?><font color=red><b> принял ваш вызов!</b></font>
<input type=hidden name="ac" value="1">
<input type=submit name="accept" value="Битва!">
<input type=hidden name="ac" value="2">
<input type=submit name="denie" value="Отказать">
</td>
</tr></table>
</form>
</td><td align=right valign=top>
<input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
</td></tr></table>

<?
}

else if($zayavka_status=="confirm_opp"){
$OPP_SQL="SELECT * FROM users WHERE login='$opponent'";
$OPP_QUERY=mysql_query($OPP_SQL);
$OPP_DATA=mysql_fetch_array($OPP_QUERY);
$op_level=$OPP_DATA["level"];

?>
<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td width=100% align=left valign=top>
<table border=0 width=100%><TR><TD>
<form name="accept2" action="zayavka.php?boy=phisic&act=recallBattle" method="POST">
<font color=red><b>Ожидается подтверждение боя от персонажа</b></font> <?print "<b>$opponent</b> [$op_level]<a href='info.php?log=$pl1' target=_new><img src='img/inf.gif' border=0 alt='Информация о персонаже $opponent'></a>";?>
<input type=hidden name="otkaz" value="1">
<input type=submit value="Отозвать вызов">
</td>
</tr></table>
</form>
</td><td align=right valign=top>
<input type=button value="Обновить" onclick="javascript:location.href='zayavka.php?boy=phisic'">
</td></tr></table>
<?
}

print "<form name=\"prinatie\" action=\"zayavka.php?boy=phisic&act=a\" method=\"POST\"><br>";


$QUERY_P=mysql_query("SELECT * FROM zayavka WHERE type='1' OR type='2' ORDER BY 'date' DESC");
$prov_za=mysql_num_rows($QUERY_P);
if ($prov_za!=0){
print "<input type=submit value=\"Принять вызов\"><br>";
}
$z=1;
while($data_p=mysql_fetch_array($QUERY_P)){
$z++;
if($data_p["status"]!=3){
$creator      = $data_p["creator"];
$date         = $data_p["date"];
$timeout      = $data_p["timeout"];
$battle_type  = $data_p["type"];
$id           = $data_p["creator"];

$T1 = mysql_query("SELECT * FROM team1 WHERE battle_id=$creator");
while($TD1 = mysql_fetch_array($T1)){
$player = $TD1["player"];
$S1="SELECT * FROM users WHERE login='$player'";
$Q1=mysql_query($S1);
$D1=mysql_fetch_array($Q1);
$p1_lev=$D1["level"];
$p1 = $player;
$pl11 = str_replace(" ","%20",$p1);
}

$p2 = '';
$T2 = mysql_query("SELECT * FROM team2 WHERE battle_id=$creator");
while($TD2 = mysql_fetch_array($T2)){
$player = $TD2["player"];
$S2="SELECT * FROM users WHERE login='$player'";
$Q2=mysql_query($S2);
$D2=mysql_fetch_array($Q2);
$p2_lev=$D2["level"];
$p2 = $player;
$pl12 = str_replace(" ","%20",$p2);
}

        if($p2==''){$rad="<input type=radio name=id value='$id'>";}
        else{
        $rad="<input type=radio name=id value='$id' disabled>";
        $p2="против <font color=black><b>$p2</b> [$p2_lev]<a href='info.php?log=$pl12' target=_new><img src='img/inf.gif' border=0></a>";
        }
        if($battle_type==1){$battle_type="<img src='img/icon/fighttype1.gif' width=\"20\" height=\"20\" alt='Физический бой'>";}
        else if($battle_type==2){$battle_type="<img src='img/icon/fighttype5.gif' width=\"20\" height=\"20\" alt='Кулачный бой'>";}
        if($p1==$db["login"]) {$rad="<input type=radio name=id value='$id' disabled>";}
$p1="<font color=black><b>$p1</b> [$p1_lev]</font><a href='info.php?log=$pl11' target=_new><img src='img/inf.gif' border=0></a>";

print "$rad <span class=date>$date</span> $p1 $p2 ";
print "тип боя: $battle_type ";
print "(таймаут $timeout мин.)";
print "<BR>";

        }
}
if ($z!=1){
print "<input type=submit value=\"Принять вызов\"><br>";
}

print "</form>";
?>
