<?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');




echo '<div class="title2"><a href="http://'.$set['home'].'/m/category">Категории</a> | <strong>Топ100</strong></div>';

$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++;

if($_SESSION['id'] == $row['id']){

$div_1 = '</div><div class="main"><b><font color="red">';}

else {

$div_1 = '</div><div class="main">';}



echo $div_1.$start.'.<a href="http://'.$set['home'].'/out/'.$row['id'].'"><b>'.$row['url'].'</b></a>   (<a href="http://'.$set['home'].'/stats/'.$row['id'].'"><b>'.$row['hosts'].'/'.$row['hits'].'</b></a>)<br/>';

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

{

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

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

}

else

{

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

}


echo '</div>';

}

navigation($all,$page_top,$page,'/',$total);

}

else

{

echo '<div class="main">';

echo 'Сайтов учавствующих в Топ-100 не обнаружено!';

echo '</div>';

}



echo '<div class="title2">';

echo '<a href="http://'.$set['home'].'/m/search">Поиск Сайта</a><br/>';

if(!$user_data)

{

echo '<a href="http://'.$set['home'].'/m/authentication">Вход</a> | <a href="http://'.$set['home'].'/m/rules">Регистрация</a> <br/> ';

}

$posl_news = mysql_query("SELECT * FROM `".$prefix."news` ORDER BY `time` DESC LIMIT ".$set['news_index']."");

if(mysql_num_rows($posl_news) > 0)

{

while($row = mysql_fetch_array($posl_news))

{

$page = ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `".$prefix."news` WHERE `id` = '".$row['id']."'"), 0) / $page_news);

}
}
echo '<a href="http://'.$set['home'].'/m/news"> Новости</a> ('.data($row['time']).')<br/>
<a href="http://'.$set['home'].'/m/allStats">Cтатистика</a><br/>
<a href="http://'.$set['home'].'/m/contacts">Контакты</a><br/></div>';







unset($_SESSION['id']);

echo '</div>';

require_once ('m/foot.php');

?>