<?php
session_start();
define('NTOP', 1);
$title = 'Главная ';
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
require_once ('m/head.php');
include_once 'wk/advert.php';



if(!$user_data)

{

echo '<div class="title"> Привет, <strong>гость</strong>! <a href="http://king-top.ru/m/authentication"><font color="#F0FFFF">Вход</font></a>  <a href="http://king-top.ru/m/registration"><font color="#F0FFFF">Регистрация</font></a> </div> ';

}

else

{  


echo '<div class="title"> Привет, <strong>'.$user_data['login'].'</strong>!
<a href="http://king-top.ru/m/office"><font color="#F0FFFF">Кабинет</font></a>  
 <a href="http://king-top.ru/exit"><font color="#F0FFFF">Выход</font></a>
</div>';
}


$vse_sait = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."sait` WHERE `status` = '1' AND `hosts` > '0'"));





$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."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 `".$prefix."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++;


echo '<div class="topni"><span class="o">'.$start.'</span> <img src="http://www.google.com/s2/favicons?domain='.$row['url'].'"/> <a href="http://'.$set['home'].'/out/'.$row['id'].'"> '.$row['url'].'</a> ['.$row['hosts'].'/'.$row['hits'].'] <a href="http://'.$set['home'].'/stats/'.$row['id'].'"><img src="/style/img/info.png" alt="?"></a><br/>';

if(mb_strlen($row['about']) > 100)

{

$text = substr($row['about'],0,100);

echo ''.$text.'...<br/>';

}

else

{

echo ''.$row['about'].'<br/></font></b></u>';


//echo '[В топ: <b>'.$row['in'].'</b> | Из топа: <b>'.$row['out'].'</b>]';

}
echo '</div>';




}


navigation($all,$page_top,$page,'/',$total);
}
else
{
echo '<div class="topni">';
echo 'Сайтов учавствующих в <b>Топ-100</b> не обнаружено!';
echo '</div>';
}
unset($_SESSION['id']);

require_once ('m/foot.php');

?>