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

echo'<div class="topik">Vip сайты</div>';
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `hosts` > '0' AND `ban` = '0' AND `plus` >= '15'"));
if($all != 0){
$total=intval(($all-1)/$page_top)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0){
$page = 1;}
if($page > $total){
$page = $total;}
if($id OR $id >= 1){
$result = mysql_query("SELECT `hosts` FROM `".$prefix."sait` WHERE `status` = '1' AND `id` = '".$id."' 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 `hosts`>=$host_today ORDER BY `hosts` DESC;"));
$page = ceil($topt/$page_top);}
$past=intval($all/$page_top);
$start=$page*$page_top-$page_top;
$top = mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `hosts` > '0' AND `ban` = '0' AND `plus` >= '15' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_top."");
while($row = mysql_fetch_array($top)){
$start++;
echo '<div class="ico"><b><font color="red"><div class="topni">'.$start.'.</font> <a href="/out.php?id='.$row['id'].'">'.$row['url'].'</b></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></div>';
}
navigation($all,$page_top,$page,'/str/vip.php?',$total);
} else {
echo '<div class="stat">Сайтов в этой категории пока нет!<br>Что бы сюда попасть нужно 15 положительных голосов, за месяц.</div>';}
require_once ('foot.php');
?>