Файл: index.php
Строк: 38
<?php
define('MKTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
$title='Toп-100';
require_once ('head.php');
$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;
echo '<div class="nav">';
if($_GET['sort'] == 'hosts' OR $_GET['sort']==null) echo 'Хосты'; else echo '<a href="/sort_hosts.php">Хосты</a>'; echo ' | ';
if($_GET['sort'] == 'hits') echo 'Хиты'; else echo '<a href="/sort_hits.php">Хиты</a>'; echo ' | ';
if($_GET['sort'] == 'in') echo 'В топ'; else echo '<a href="/sort_in.php">В топ</a>'; echo ' | ';
if($_GET['sort'] == 'out') echo 'Из топа'; else echo '<a href="/sort_out.php">Из топа</a>';
echo '</div>';
if($_GET['sort'] == 'hits') $sort= 'hits';
elseif($_GET['sort'] == 'in') $sort= 'in';
elseif($_GET['sort'] == 'out') $sort= 'out';
else $sort= 'hosts';
$top = mysql_query("SELECT * FROM `sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' ORDER BY `".$sort."` DESC LIMIT ".$start.",".$page_top."");
while($row = mysql_fetch_array($top)){
$start++;
echo '<div class="text">';
echo '<a href="/out/'.$row['id'].'.php">'.$start.') <img src="http://www.google.com/s2/favicons?domain='.$row['url'].'"/>'.$row['name'].' <span class="stat">'.$row['hosts'].'/'.$row['hits'].'</span></a><br/>';
if(mb_strlen($row['about']) > 50){
$text = mb_substr($row['about'], 0, 50, 'utf-8');
echo ''.$text.'... <br/><a href="/info/'.$row['id'].'.php">Подробней</a>';
}
else echo ''.$row['about'].'<br/><a href="/info/'.$row['id'].'.php">Подробней</a>';
echo '</div>';
if(isset($user_data) AND $user_data['level'] >= 2){
echo '<div class="text"><a href="/adminka/platforms.php?act=edit_sait&id='.$row['id'].'">Редактировать</a> ';
echo '<a href="/adminka/platforms.php?act=ban&id='.$row['id'].'">Заблокировать</a> ';
echo '<a href="/adminka/platforms.php?act=del_sait&id='.$row['id'].'">Удалить</a></div>';
}
}
navigation($all,$page_top,$page,'index.php?sort='.$sort.'&',$total);
}
else echo '<div class="text">Сайтов, учавствующих в Тор-100, не обнаружено</div>';
require_once ('foot.php');
?>