<?php
define('MTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
require_once ('head.php');

$cat_all = mysql_num_rows(mysql_query("SELECT * FROM `cat`"));
echo '<table class="title2" width="100%" style="padding: 10px;"><tr><td style="width: 33.33%;"><a href="/m/category"><font color="black"><center>Категории</center></font></a> </td> <td style="    border-left: 1px solid #c0c0c0;"><center><img src="'.$HOME.'/images/stars.png" alt="*"> <b>ТОП 100</b> <img src="'.$HOME.'/images/stars.png" alt="*"></center><td style="    border-left: 1px solid #c0c0c0;"><a href="/vip.php"><font color="black"><center><b style="color: #aa20d7;">VIP</b> сайты</center></font></a></td></tr></table>';

$platform = mysql_query("SELECT * FROM `sait` WHERE `vip` > '".time()."' ORDER BY rand() DESC LIMIT 1");
while($row = mysql_fetch_array($platform))
{


if($row['id'] == $_GET['id_site']) {
$red = '<font color="red">'.$row['url'].'</font>';
} else {
$red = buildTextGradient($row['url'], array($row['n1'], $row['n2']));
}
 
if($start == 1) { $icon = 'mobile-icon-gold'; } 
if($start == 2) { $icon = 'mobile-icon-silver'; } 
if($start == 3) { $icon = 'mobile-icon-bronze'; } 
if($start >= 4) { $icon = 'mobile-icon'; } 	
echo '<table width="100%" cellpadding="5" cellspacing="0"  class="vips"><tbody><tr>
                <td width="1%" style="padding: 9px;"><img src="'.$HOME.'/images/crown.png" alt="VIP" title="VIP сайт"></td>
                <td width="89%" style="padding: 9px;"> <img src="//www.google.com/s2/favicons?domain='.$row['url'].'" alt="favicon"> <a id="outlink" href="/out.php?id='.$row['id'].'" rel="nofollow"  target="_blank" title="Посетить wap сайт '.$row['url'].'"><b class="zl">'.$red.'</b></span></a> <b> '.($row['category']==4 ? '<img src="'.$HOME.'/images/18.png" alt="*">':'') .'
				
				<span class="badge"><span class="hosts">'.$row['hosts'].'</span> <span class="hits">'.$row['hits'].'</span></span></b> <br>';
                if(mb_strlen($row['about']) > 65){
$text = mb_substr($row['about'], 0, 65, 'utf-8');
echo $text;
}else{
echo $row['about'];
}
echo '</td>
                <td width="10%" style="padding: 0px;"> <a href="/stats/'.$row['id'].'"><img src="'.$HOME.'/images/ico-stat.png" alt="*" title="Статистика сайта"></a></td>
                
            </tr>
        </tbody></table>';	
}


$page_top = $set['page_top'];
$all = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0'"));
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;
$past=intval($all/$page_top);
$start=$page*$page_top-$page_top;
$top = mysql_query("SELECT * FROM `sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_top."");

while($row = mysql_fetch_array($top)){


$start++;



if($row['id'] == $_GET['id_site']) {
$red = '<font color="red">'.$row['url'].'</font>';
} else {
$red = buildTextGradient($row['url'], array($row['n1'], $row['n2']));
}
 
if($start == 1) { $icon = 'mobile-icon-gold'; } 
if($start == 2) { $icon = 'mobile-icon-silver'; } 
if($start == 3) { $icon = 'mobile-icon-bronze'; } 
if($start >= 4) { $icon = 'mobile-icon'; } 	
echo '<table width="100%" cellpadding="5" cellspacing="0"  class="'.($row['vip'] > time() ? 'vips':'main' ).'"><tbody><tr>
                <td width="1%" style="padding: 9px;"><span class="'.$icon.'">'.$start.'</span></td>
                <td width="89%" style="padding: 9px;"> <img src="https://ioav.ru/fv/'.$row['url'].'" alt="favicon"> <a id="outlink" href="/out.php?id='.$row['id'].'" rel="nofollow"  target="_blank" title="Посетить wap сайт '.$row['url'].'"><b class="zl">'.$red.'</b></span></a> <b> '.($row['category']==4 ? '<img src="'.$HOME.'/images/18.png" alt="*">':'') .'
				
				<span class="badge"><span class="hosts">'.$row['hosts'].'</span> <span class="hits">'.$row['hits'].'</span></span></b> <br>';
                if(mb_strlen($row['about']) > 65){
$text = mb_substr($row['about'], 0, 65, 'utf-8');
echo $text;
}else{
echo $row['about'];
}
echo '</td>
                <td width="10%" style="padding: 0px;"> <a href="/stats/'.$row['id'].'"><img src="'.$HOME.'/images/ico-stat.png" alt="*" title="Статистика сайта"></a></td>
                
            </tr>
        </tbody></table>';	



	



}
navigation($all,$page_top,$page,'index.php?sort='.$sort.'&',$total);
echo '<center style="padding: 15px;"><img class="rot" src="'.$HOME.'/style/img/ico-cube.png" alt="*"> <a class="link-buttoms" rel="nofollow" href="/randsite.php"  target="_blank">  Случайный сайт </a>  &nbsp; &mdash; Накликай удачу!</center>';

}
else
{
echo '<div class="main">Сайтов в TOP-100 не обнаружено!</div>';
}



$tops = mysql_query("SELECT * FROM `news` ORDER BY `time` DESC LIMIT 1");
while($rows = mysql_fetch_array($tops)){
echo '<div class="wsr viewmob"><b><a href="'.$HOME.'/news/'.$rows['id'].'">'.$rows['name'].'</a></b> <br />
'.$rows['text'].'</div>';
}


require_once ('foot.php');
?>
