<?php
define('NTOP', 1);
$title = 'Топ рейтинг сайтов';
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');

require_once ('str/head.php');
if($_COOKIE['version'] == 'web'){

echo '<table class="stata"><tr>
                	<th class="left0 top0">#</th>
                	<th class="top0">Сайты из категории Top-100</th>
                	<th class="top0">Хосты</th>
                	<th class="top0">Хиты</th>
                            <th class="top0">В топ</th>
                	<th class="top0">Из</th>
                	<th class="right0 top0">?</th></tr>';
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19'"));
if($all != 0){
$total = intval(($all-1)/20)+1;
$page = abs(intval($_GET['page']));
if($id or $id >= 1){
$result = mysql_query("SELECT `hosts` FROM `".$prefix."sait` WHERE `id` = '".$id."' AND `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19' LIMIT 1;");
$row = mysql_fetch_array($result);
$host_today = $row['hosts'];
$topt = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `category` != '19' AND `hosts`>= '".$host_today."' ORDER BY `hosts` DESC;"));
$page = ceil($topt/20);
}
if(empty($page) OR $page <= 0){
$page = 1;
}
if($page > $total){
$page = $total;
}
$past=intval($all/20);
$start=$page*20-20;
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19' ORDER BY `hosts` DESC LIMIT ".$start.",20");
while($row = mysql_fetch_array($top)){
$start++;
echo '<tr class="tr2"><td class="num bold left0">'.$start.'</td>';
if($row['id'] == $id){
echo'<td class="site"><a href="/out.php?id='.$row['id'].'"><font color="red">'.$row['url'].'</font></a>';
} else {
echo'<td class="site"><a href="/out.php?id='.$row['id'].'">'.$row['url'].'</a>';
}
echo'<br><small>'.$row['about'].'</small></td>
<td>'.stats($row['hosts']).'</td>
<td>'.stats($row['hits']).'</td>
<td>'.$row['in'].'</td>
<td>'.$row['out'].'</td>';
if($row['mem'] == 0){echo'<td class="more right0"><a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?" style="padding:2px;padding-top:4px;"></a></td></tr>';
}else{echo'<td class="more right0"><img src="/images/d.gif" alt="?" style="padding:2px;padding-top:4px;"></td></tr>';}}
echo'</table>';
navigation($all,20,$page,'index.php?',$total);
} else {
echo '<div class="stat">Сайтов в топе пока нет!</div>';}

}else{

$l = mysql_query("SELECT * FROM `".$prefix."rek` WHERE `status` = '1' ORDER BY `id` DESC");
echo '<div class="rek"><img src="http://zipvap.ru/style/img/reklama.gif" alt="Реклама"/></img><br>';echo'<a href="reklama.php">Свободное место 50р.</a><br/>';
while($rek = mysql_fetch_array($l)){
if(empty($rek['color']))echo '<a href="http://'.$rek['url'].'">'.$rek['name'].'</a><br>'; else echo '<a href="http://'.$rek['url'].'"><font color="'.$rek['color'].'">'.$rek['name'].'</font></a><br>';}
function my_link ($uid)
{ $get = @file_get_contents
("http://ontraf.ru/c_gen.php?id=$uid");
if (!$get) { return false;
} else { return $get;
}}
echo my_link(248);
echo '</div>';
echo'<div class="topik">Top 100 | <b><a href="/str/cat.php">Категории</a></b></div>';
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19'"));
if($all != 0){
$total = intval(($all-1)/$page_top)+1;
$page = abs(intval($_GET['page']));
if($id or $id >= 1){
$result = mysql_query("SELECT `hosts` FROM `".$prefix."sait` WHERE `id` = '".$id."' AND `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19' LIMIT 1;");
$row = mysql_fetch_array($result);
$host_today = $row['hosts'];
$topt = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `category` != '19' AND `hosts`>= '".$host_today."' ORDER BY `hosts` DESC;"));
$page = ceil($topt/$page_top);
}
if(empty($page) OR $page <= 0){
$page = 1;
}
if($page > $total){
$page = $total;
}
$past=intval($all/$page_top);
$start=$page*$page_top-$page_top;
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' AND `category` != '19' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_top."");
while($row = mysql_fetch_array($top)){
if($row['id'] == $id){
$start++;
echo '<div class="ico"><b><font color="red"><div class="topni">'.$start.'. <a href="/out.php?id='.$row['id'].'"><span class="site"></font><font color=red>'.$row['url'].'</b></font></span></a> <small><b>('.$row['hosts'].'/'.$row['hits'].'</b>';
//echo <b>($row['hits'] > 999 ? round($row['hits']/1000).'К' : $row['hits'])</b>;
if($row['mem'] == 0){
echo'<b>)</b></small> <a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?"></a>';}else{echo'<b>)</b></small> <img src="/images/d.gif" alt="*">';}
} else {
$start++;
echo '<div class="ico"><div class="topni"><b><font color="red">'.$start.'.</font> <a href="/out.php?id='.$row['id'].'"><span class="site">'.$row['url'].'</b></span></a> <small><b>('.$row['hosts'].'/'.$row['hits'].'</b>';
//echo <b>($row['hits'] > 999 ? round($row['hits']/1000).'К' : $row['hits'])</b>;
if($row['mem'] == 0){
echo'<b>)</b></small> <a href="/str/infos.php?id='.$row['id'].'"><img src="/images/s.gif" alt="?"></a>';}else{echo'<b>)</b></small> <img src="/images/d.gif" alt="*">';}}
echo'<div class="info">'.$row['about'].'</div></div>';
echo '<div class="str">Ушло на сайт: <b>'.$row['out'].'</b><br/></div></div></div>';

}
echo'<div class="t">За сегодня | <a href="/index2.php">За вчера</a></div>';
navigation($all,$page_top,$page,'index.php?',$total);
} else {
echo '<div class="stat">Сайтов в топе пока нет!</div>';}

echo'<div class="topik">';
if(!$user_data){echo'<a href="/str/enter.php">Войти</a> | <a href="/str/reg.php">Регистрация</a><br>';}else{
echo'<a href="/str/office.php"><b>'.$user_data['login'].'</b></a> | <a href="/str/enter.php?act=exit">Выход</a><br>';}
echo '<a href="/news/index.php">Новости</a><br><a href="/str/statistika.php">Статистика</a><br><a href="/str/ban.php">Заблокированные</a><br></div>';
echo '<div class="footer"><center><a href="http://zipvap.ru/go.php?id=1"><img src="http://zipvap.ru/image.php?act=on&id=1" alt="ZipVap.Ru"/></a><img src="http://c.waplog.net/475730.cnt" alt="" width="1" height="1"/>
<a href="http://topez.ru/go/532"><img src="http://topez.ru/imageOther/532" alt=""/></a><img src="http://wuplog.net/imageOther/251" alt="" width="1" height="1"/>
<a href="http://oztop.ru/go/2713"><img src="http://oztop.ru/imageOther/2713" alt="oztop"/></a><img src="http://zipvap.ru/image.php?act=small&amp;id=2" alt="" width="1" height="1"/>
<a href="http://waplog.net/c.shtml?459551"><img src="http://c.waplog.net/459551.cnt" alt="waplog" /></a><img src="http://top.bodr.net/c.php?id=169110" alt="" width="1" height="1"/>
<a href="http://o5top.ru/in.php?11027"><img src="http://o5top.ru/img.php?11027-small" alt="o5top" /></a><a href="http://imtop.ru/13718/in/"><img src="http://imtop.ru/13718/small.png" alt="" /></a>
<img src="http://sowap.ru/countmini.php?uid=417" alt="" width="1" height="1"/><img src="http://wapglob.us/3388.img?size=small" alt="" width="1" height="1"/>
<a href="http://gigatop.net/in.php?22614"><img src="http://gigatop.net/c.php?22614" alt=""/></a><img src="http://erotop.su/imageOther/398" alt="" width="1" height="1"/>
<a href="http://wapglob.us/3462.go"><img src="http://wapglob.us/3462.img?size=small" alt=""/></a>
<a href="http://top.bodr.net/?cid=169840"><img src="http://top.bodr.net/c.php?id=169840" alt=""/></a>
<a href="http://razwap.ru/in.php?id=789"><img src="http://razwap.ru/hisob.php?id=789&mini" alt="" width="1" height="1"/></a>
<a href="http://exstat.ru/go.php?id=1973"><img src="http://exstat.ru/image.php?act=small&amp;id=1973" alt="exstat"/></a>
<br><a href="http://wmrclub.ru/konkurs.php"><img src="http://wmrclub.ru/images/ban1.gif" alt="Конкурс"/></a><a href="http://flowap.ru/forum/index.php?id=3441"><img src="http://flowap.ru/forum/files/banner_2.png" alt="Конкурс"/></a><br/></center></div>';

}
?>