<?
include_once("req.php");

array_walk($_REQUEST,"format_string");   
array_walk($_POST,"format_string");   
array_walk($_GET,"format_string");   

?><HTML><HEAD><TITLE>ANTIBK Online</TITLE>
<META content=INDEX,FOLLOW name=robots>
<META content="1 days" name=revisit-after>
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-control content=private>
<META http-equiv=Expires content=0>

<SCRIPT src='../i/commoninf.js'></SCRIPT>
<link href="../i/images/main1.css" rel="stylesheet" type="text/css">
<style type="text/css">
.style6 {	color: #DFD3A3;
	font-size: 9px;
}
A:link {
	FONT-WEIGHT: normal; COLOR: #524936; TEXT-DECORATION: none
}
A:visited {
	FONT-WEIGHT: normal; COLOR: #633525; TEXT-DECORATION: none
}
A:active {
	FONT-WEIGHT: normal; COLOR: #77684d; TEXT-DECORATION: none
}
A:hover {
	COLOR: #000000; TEXT-DECORATION: underline
}
.style10 {font-size: 9pt; font-weight: bold; }
.style7 {font-size: 9pt}
.style8 {color: #4F4B49}

</style>
</HEAD>
<BODY bgColor=#000000 leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign=top><td>
	<table width="100%" height="135"  border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td background="../i/images/sitebk_02.jpg" scope="col" align=center><a href="/" onClick="this.blur()"><img src="../i/register/siteabk_03ru.gif" width="194" height="135" border=0></a></td>
	</tr>
	</table>
  </td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgColor=#3D3D3B>
  <tr valign=top>
	<td width="15%">
	</td>
	<td align=center>
		<table cellspacing=0 cellpadding=0 width="100%" bgcolor=#f2e5b1 border=0>
		<tr valign=top>
		<td width="29" rowspan=2 background="../i/images/n21_08_1.jpg">
		<img src="../i/images/raitt_08.jpg" width="29" height="256"></td>

		<td><img src="../i/images/raitt_04.jpg" width="118" height="257"></td>
		<td rowspan=2>



			<!-- Begin of text -->
<!-- Begin of text -->
        <h3><br>
          </h3>
        <TABLE width="100%" border=0 cellPadding=2 cellSpacing=0 name="F1">
            <TBODY>

              <td bgcolor="#F2E5B1">
                <td valign=top><img src="../i/images/ratina_10.gif" width="135" height="26"><br><BR>
                	<TABLE width=100%><td>&nbsp; &nbsp; Рейтинг <B>бойцов</B> и <A href="topgen.php?m=0.892722105162527">магов</A>
                    	<TD align=right>Статистика на <span class="style8"><code><? echo date("d.m.y H:i"); ?></code></span></TABLE>

                    <P>
		
                    <P>
                      <table width="100%"  border="0" cellpadding="0" cellspacing="0" background="../i/images/ram12_34.gif">
                        <tr>
                          <td align="left" scope="col"><img src="../i/images/ram12_33.gif" width="12" height="11"></td>
                          <td scope="col"></td>
                          <td width="18" align="right" scope="col"><img src="../i/images/ram12_35.gif" width="13" height="11"></td>
                        </tr>
                      </table>

                            <table width=100% border=0 align=center cellpadding=0 cellspacing="1">
                              <tr>
                                <td colspan="5"></td>
                              </tr>
                              <tr bgcolor="#ECDFAA">
                                <td><b>№</b></td>
                                <td><b></b></td>
                                <td><b></b></td>
                                <td align="right"><b>рейтинг </b></td>

                                <td>&nbsp;</td>
                              </tr>
                              <tr bgcolor="#3D3D3B">
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                              </tr>
				
<?
include_once("database.php");
/* АВТОДЕТЕКТ ID_STEP
$res=db_use('query',"select * from person where id_step=85");
unset($i);while($i<mysql_num_rows($res)) {
	$i++;$s=mysql_fetch_array($res);
		$res2=db_use('array',"select id_step from exptable where need_exp>'".$s['exp']."' and need_exp<='".$s['exp']."'");
		db_use('query',"update person set id_step='".$res2['id_step']."' where id_person='".$s['id_person']."'");
}
*/
/*
$res=db_use('query',"select max(ls.login_time) as lt,p.wins*101+p.loss*21+p.nich*11 as reit,p.blocked,p.id_person,u.login,p.persname,p.align,c.clanname,p.wins,p.loss,p.level,p.id_step,s.username,u.id_user from person p 
left join users u on u.id_person=p.id_person 
left join clans c on c.id_clan=p.id_clan 
left join sessions s on s.username=u.login
left join login_stat ls on ls.id_user=u.id_user
where p.blocked<1 group by reit DESC ");				
*/
$res=db_use('query',"select max(ls.login_time) as lt,p.exp as reit,p.blocked,p.id_person,u.login,p.persname,p.align,c.clanname,p.wins,p.loss,p.level,p.id_step,s.username,u.id_user,po.id_person as inv
 from person p 
left join users u on u.id_person=p.id_person 
left join clans c on c.id_clan=p.id_clan 
left join sessions s on s.username=u.login
left join login_stat ls on ls.id_user=u.id_user
left join person_on po on po.id_person=p.id_person and po.type=5
where p.blocked<1 and p.id_person!=1 and p.id_person!=22 group by reit DESC ");				

$n=true;
unset($i);while ($i<mysql_num_rows($res)) {
	$i++;$s=mysql_fetch_array($res);$n=($n?false:true);
	#$r1=db_use('array',"select max(login_time) as lt from login_stat ls where ls.id_user='".$s['id_user']."'");
	if (!$found) {$found=($_REQUEST['n']==($s['persname']?$s['persname']:$s['login']));}
#$reit=($s['wins']-$s['loss'])/100+($s['wins']+$s['loss'])/100;
	if ($_REQUEST['n']==($s['persname']?$s['persname']:$s['login'])) { #нажат
		if ($s['username'] && !$s[inv]) { #онлайн
		$bg=' bgcolor="8AC0CC"';
		}else{ #оффлайн
		$bg=' bgcolor="#CCBF8A"';
		}
	}else{ # Не нажат
		if ($s['username'] && !$s[inv]) { #онлайн
		$bg=' bgcolor="A8DEE6"';
		}else{ #оффлайн
		$bg=($n?' bgcolor="#ECDFAA"':'');
		}
	}
	$m=$s['lt'];
	$tm=mktime($m[11].$m[12],$m[14].$m[15],$m[17].$m[18],$m[5].$m[6],$m[8].$m[9],$m[0].$m[1].$m[2].$m[3]);
	$s2="<tr".$bg."> <td align=right valign=\"top\" class='mystrong'>".$i.".&nbsp;</td>
	<td valign=\"top\"><span class=\"style10\">&nbsp;".($s['blocked']?'<strike>':'')."<SCRIPT>drwfl(\"".($s['persname']?$s['persname']:$s['login'])."\",".$s['id_person'].",\"".$s['level']."\",'".$s['align']."',\"".$s['clanname']."\")</SCRIPT> ".($s['blocked']?'</strike>':'')."</span></td><td>".(($s['username'] && !$s[inv])?'':'<font size=-3>- Последний заход: '.$s['lt'])."</font></td>
<td align=right valign=\"top\"><b>".(int)($s['reit'])."</b></td></tr>";		

	if ($i<=200) {
		echo $s2;
	}elseif ($i==201 && !$found) {
?>
                              <tr bgcolor="#3D3D3B"><td colspan=3></td>
                              <tr><td colspan=3 align='center'><SMALL><BR>...<BR><BR></SMALL></td>

                              <tr bgcolor="#3D3D3B"><td colspan=3></td></TR>
<?
	}elseif ($i>201) {
		# сдвигаем в любом случае если $my!=10
		if ($my!=10) {
			$st[]=$s2;if (count($st)>20) {array_slice($st, 1);$my=($my?$my-1:'');}
		}
		if ($_REQUEST['n']==($s['persname']?$s['persname']:$s['login'])) {
			$my=count($st);
		}
	}
}
if ($my) {
	for ($i=0;$i<count($st);$i++) {
		echo $st[$i];
	}
}				
?>
			
				
                              <tr>
                                <td colspan=4><img src="../i/images/1x1.gif" width="1" height="1" border=0 alt=""></td>
                                <td></td>
                              </tr>
                              <tr>
                                <td colspan=5><table width="100%"  border="0" cellpadding="0" cellspacing="0" background="../i/images/ram12_34.gif">
                                    <tr>
                                      <td align="left" scope="col"><img src="../i/images/ram12_33.gif" width="12" height="11"></td>

                                      <td scope="col"></td>
                                      <td width="18" align="right" scope="col"><img src="../i/images/ram12_35.gif" width="13" height="11"></td>
                                    </tr>
                                </table></td>
                              </tr>
                            </table>
                              <br>
                            </p>
                  </FORM>

		
                    </td>
              </tr>
        </TABLE>
<!-- End of text -->

		</td>
		<td align=right><img height=144 src="../i/images/rairus_03.jpg" width=139 border=0></td>
		<td valign=top background="../i/images/nnn21_03_1.jpg">&nbsp;&nbsp;&nbsp;&nbsp;</td>
		</tr>

		<tr valign=top>
		<td></td>
		<td valign=bottom style="padding-bottom:50"><IMG height=236 src="../i/images/raitt_15.jpg" width=128 border=0></td>
		<td width="23" valign=top background="../i/images/nnn21_03_1.jpg">&nbsp;</td>
		</tr>
		</table>

	</td>
	<td width="15%">

	</td>
  </tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor=#000000>
    <TR>
      <TD colspan=3 width="100%" height=13 background="../i/register/sitebk_07.jpg"></TD>
    </TR>
  <tr valign=top>
	<td width="20%">

              <div align="center">
<!--Rating@Mail.ru COUNTEr--><script language="JavaScript" type="text/javascript"><!--
d=document;var a='';a+=';r='+escape(d.referrer)
js=10//--></script><script language="JavaScript1.1" type="text/javascript"><!--
a+=';j='+navigator.javaEnabled()
js=11//--></script><script language="JavaScript1.2" type="text/javascript"><!--
s=screen;a+=';s='+s.width+'*'+s.height
a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth)
js=12//--></script><script language="JavaScript1.3" type="text/javascript"><!--
js=13//--></script><script language="JavaScript" type="text/javascript"><!--
d.write('<a href="http://top.mail.ru/jump?from=1136139"'+
' target=_top><img src="http://d6.c5.b1.a1.top.list.ru/counter'+
'?id=1136139;t=50;js='+js+a+';rand='+Math.random()+
'" alt="Рейтинг@Mail.ru"'+' border=0 height=31 width=88/><\/a>')
if(11<js)d.write('<'+'!-- ')//--></script><noscript><a
target=_top href="http://top.mail.ru/jump?from=1136139"><img
src="http://d6.c5.b1.a1.top.list.ru/counter?js=na;id=1136139;t=50"
border=0 height=31 width=88
alt="Рейтинг@Mail.ru"/></a></noscript><script language="JavaScript" type="text/javascript"><!--
if(11<js)d.write('--'+'>')//--></script><!--/COUNTER-->
              </div>
	</td>
	<td align=center><br>
		<div align="center"><NOBR><span class="style6">ANTIBK Online</span></NOBR></div>
	</td>

	<td width="20%">
	</td>
  </tr>
</table>
</BODY>
</HTML>
