<?
 include_once('database.php');
 
$domain=trim($_REQUEST['d']);
if (substr($domain,0,4)=='www.') { $domain=substr($domain,4); }
$res=db_use('array',"select * from top where (url like 'http://".addslashes($domain)."%' or url like 'http://www.".addslashes($domain)."%') and deleted<1;");
if (!$res['id_site']){ $site=false;} else {$site=true;$id_site=$res['id_site'];}

if (!$site) {die;}else{
$id_site=$res['id_site'];
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <meta http-equiv="Content-Language" content="ru">
    <meta name="KEYWORDS" content="АНТИБК, игра, онлайн игра, онлайн, on-line, чат, общение, ролевые игры, интернет, РПГ, RPG, без правил, бои, форум, энциклопедия">
    <meta name="description" content="АНТИБК">
     <title>АНТИБК | Рейтинг</title>
	<meta http-equiv="Content-type" content="text/html; charset=windows-1251">
<SCRIPT LANGUAGE="JavaScript">

var max = <? 
#maxhits
$maxsz=db_use('array',"select max(vizit) as maxx from top_stat where id_site='".$id_site."'");
echo $maxsz['maxx'];
?>;
var maxsz = 350;
function w(hosts, hits)
{
	if (max>0 && (hosts>0 || hits>0)) {
		var s = maxsz/max;
		document.write('<IMG SRC="../i/1green.gif" WIDTH="'+(hosts*s)+'" HEIGHT=12 BORDER=0 ALT=""><IMG SRC="../i/1silver.gif" WIDTH="'+((hits-hosts)*s)+'" HEIGHT=12 BORDER=0 ALT="">');
	}
}

</SCRIPT>
</head>

<body bgcolor=#666666 rightmargin=0 topmargin=0 leftmargin=0 bottommargin=0 marignwidth=0 marginheight=0 link=#000000 alink=#000000 vlink=#333333>

<table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td width=15% valign=top>
<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td width=100% height=36></td></tr>
<tr><td width=100% height=83 bgcolor=#000000></td></tr></table>
</td><td width=70% valign=top>
<div align=center><img src="../i/images/deviz.gif" border=0 width="459" height="21"></div>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td width=50% height=15></td>
<td width=269 height=15><img src="../i/images/top.gif" border=0 width="269" height="15"></td>
<td width=50% height=15></td>
</tr>
<tr>
<td width=50% height=83 bgcolor=#000000></td>

<td width=269 height=83 bgcolor=#000000><a href="http://www.antibk.org">
<img src="../i/images/logo.jpg" border=0 width="269" height="83"></a></td>
<td width=50% height=83 bgcolor=#000000></td>
</tr>
<tr>
<td width=50% height=24 bgcolor=#F2E5B1></td>
<td width=269 height=24><img src="../i/images/bottom.gif" border=0 width="269" height="24"></td>
<td width=50% height=24 bgcolor=#F2E5B1></td>
</tr>
</table>

<table width=100% cellpadding=0 cellspacing=0 border=0 bgcolor=#F2E5B1>
<tr>
<td width=100% colspan=3><img src="../i/images/back_yellow.gif" width=620 height=1 border=0><br></td></tr>
<tr>
<td width=85% colspan=2>
<H2>&nbsp; &nbsp;&nbsp; &nbsp;<A HREF="./">Рейтинг АНТИБК</A></H2></td>
<td width=15% rowspan=2 valign=top><img border="0" src="../i/images/icon_counter.gif" width="100" height="99"><br><br>
<div align=right>
<table height=90% cellpadding=0 cellspacing=0 border=0><tr><td background="../i/images/paper.jpg" valign=top>
  <img src="../i/images/paper1.jpg" border=0 width="39" height="292">
</td></tr></table>
</div>
</td>
</tr>
<tr>
<td width=10% valign=top><img border="0" src="../i/images/pict_clans.jpg" width="126" height="243"></td>
<td width=75% valign=top>
<br>
<?


echo "<P>
<B>".$res['nazv']."</B><P>
Группа: ";
					switch ($res['razdel']) {
					case 1:echo 'Кланы';break;
					case 2:echo 'В помощь начинающим (FAQ, руководства, советы...)';break;
					case 3:echo 'Газеты о Бойцовском клубе';break;
					case 4:echo 'Статьи, фото галереи и т.п.';break;
					case 5:echo 'Прочее';break;
					}
					echo"<BR>
URL: <A HREF=\"".$res['url']."\" target=_blank>".$res['url']."</A><BR>
Дата регистрации: ".date("d.m.Y H:i",$res['timereg'])."<BR>
Описание:<BR>
<I>".nl2br(str_replace("\\","&#x5C;",htmlspecialchars($res['opisan'])))."</I><P>
";
}
if(!$_REQUEST['date']) {
?>

<TABLE border=0 width=90% cellpadding=0>
<TR bgcolor="#E1DEB5"><TD align=center colspan=4><B>Динамика визитов</B></TD></TR>
<TR>
	<TD><B>Дата</B></TD>
	<TD align=right><B>Посетители</B></TD>
	<TD align=right><B>Визиты</B></TD>
	<TD align=center><B>График</B></TD>
</TR>
<TR>
	<TD bgcolor="#747474"><IMG SRC="../i/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
	<TD bgcolor="#747474"><IMG SRC="../i/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
	<TD bgcolor="#747474"><IMG SRC="../i/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
	<TD bgcolor="#747474"><IMG SRC="../i/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
</TR>
<?
$res=db_use('query',"select * from top_stat where id_site='".$id_site."' order by timeday desc limit 30");
unset($i);while ($i<mysql_num_rows($res)) {
	$i++;$s=mysql_fetch_array($res);$d=$s['timeday'];$date=$d[8].$d[9].'.'.$d[5].$d[6].'.'.$d[2].$d[3];
	echo "<TR><TD>".$date."</TD><TD align=right><B>".$s['host']."</B></TD><TD align=right><B>".$s['vizit']."</B></TD><TD>&nbsp;<SCRIPT>w(".$s['host'].",".$s['vizit'].")</SCRIPT></TD></TR>";
}
?>

<TR>
	<TD colspan=4 bgcolor="#747474"><IMG SRC="../i/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
</TR>
</TABLE>
<?
}else{
$reqtime=$_REQUEST['date'];$reqday=date("d.m.y",$reqtime);
$req_daystart=mktime(0,0,0,substr($reqday,3,2),substr($reqday,0,2),str_pad(substr($reqday,6,4),4,'2006',STR_PAD_LEFT));

$curtime=time();$curday=date("d.m.y",$curtime);
$this_daystart=mktime(0,0,0,substr($curday,3,2),substr($curday,0,2),str_pad(substr($curday,6,4),4,'2006',STR_PAD_LEFT));

$before_daystart=$req_daystart-24*60*60;
$after_daystart=$req_daystart+24*60*60;

$finddate=date('Y-m-d',$_REQUEST['date']);
$viewdate=date("d.m.Y",$_REQUEST['date']);

?>
<TABLE border=0 width=100% bgcolor="#E1DEB5">
<TR>
<?
echo '<TD width=33%><A HREF="detail.php?d='.$domain.'&date='.$before_daystart.'">« пред. день</A></TD>';
?>
	<TD width=33% align=center><B><? echo $viewdate;?></B></TD>
<?
#получить 

#$curday_view=date("d.m.y",$this_daystart); 
#$before_view=date("d.m.y",$before_daystart);
#$after_view=date("d.m.y",$after_daystart);

echo '<TD width=33% align=right>'.($after_daystart>=$this_daystart+24*60*60?'&nbsp;':'<A HREF="detail.php?d='.$domain.'&date='.$after_daystart.'">след. день »</A>').'</TD>';
?>
</TR>
</TABLE>
<TABLE border=0 width=90% cellpadding=0 align=center>
<TR>
	<TD><B>Страница</B></TD>
	<TD align=right><B>Визитов</B></TD>
</TR>
<TR>
	<TD bgcolor="#747474"><IMG SRC="/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
	<TD bgcolor="#747474"><IMG SRC="/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
</TR>
<?
$res=db_use('query',"select * from top_fullstat where id_site='".$id_site."' and timeday='".$finddate."' order by vizit desc");
unset($i);while ($i<mysql_num_rows($res)) {
	$i++;$s=mysql_fetch_array($res);#$d=$s['timeday'];$date=$d[8].$d[9].'.'.$d[5].$d[6].'.'.$d[2].$d[3];
	echo "<TR><TD>".($s['page']?$s['page']:'главная')."</TD><TD align=right><B>".$s['vizit']."</B></TD></TR>";
}
?>
<TR>
	<TD colspan=2 bgcolor="#747474"><IMG SRC="/images/1x1.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""></TD>
</TR>
</TABLE><? 
}
?>

<BR>&nbsp;
<FIELDSET><LEGEND><B>Меню</B> </LEGEND>
&nbsp; <A HREF="detail.php?d=<? echo $domain; ?>">Динамика визитов</A><BR>
&nbsp; <A HREF="detail.php?d=<? echo $domain; ?>&date=<? echo time(); ?>">Посещаемость страниц</A><BR>
&nbsp; <A HREF="./">Вернуться в рейтинг</A>
<FORM METHOD=POST ACTION="reg.php">
&nbsp; Редактировать. Укажите пароль <INPUT TYPE="password" name="editpsw"><INPUT TYPE="hidden" name="editurl" value="<? echo $domain; ?>">
<INPUT TYPE="submit" value="Редактировать">
</FORM>
</FIELDSET>
<!-- End of text -->
&nbsp;<P>
&nbsp;<BR>

<br><br>
</td>
</tr>
<tr>
<td width=100% colspan=3 height=10 bgcolor=#000000></td>
</tr>
<tr><td width=100% colspan=3 align=left bgcolor=#666666>
             <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--><SCRIPT LANGUAGE="JavaScript">document.write('<A HREF="http://antibk.org/top/c.php?jump" target=_blank><IMG SRC="http://antibk.org/top/c.php?z11&tmp='+Math.random()+'" WIDTH=88 HEIGHT=33 BORDER=0 ALT="Рейтинг Бойцовского клуба"></A>');</SCRIPT><noscript><A HREF="http://antibk.org/top/c.php?jump" target=_blank><IMG SRC="http://antibk.org/top/c.php?z11" WIDTH=88 HEIGHT=33 BORDER=0 ALT="Рейтинг АНТИБК Online"></A></noscript>
              </div>
</td></tr>
</table>
<br><br><br>


</td><td width=15% valign=top>
<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td width=100% height=36></td></tr>
<tr><td width=100% height=83 bgcolor=#000000></td></tr></table>
</td></tr></table>
</body>
</html>