Файл: cat.php
Строк: 61
<?php
///////////////////////////////////////
// //
// Автор скрипта: maxim529 //
// Email: kaznet@spaces.ru //
// ICQ: 632360940 //
// //
///////////////////////////////////////
define('MKTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
switch($act){
default:
$title = 'Категории';
require_once ('head.php');
$cats = mysql_query("SELECT * FROM `cat` ORDER BY `position`");
while($cat = mysql_fetch_array($cats)){
$count_sites = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `category` = '".$cat['id']."' AND `status` = '1' AND `ban` = '0'"));
echo '<a class="link" href = "/cat.php?act=view&id='.$cat['id'].'">'.$cat['name'].' <span class="stat">'.$count_sites.'</span></a>';
if(isset($user_data) AND $user_data['level'] == 3)
echo '<div class="text"><a href="/adminka/category.php?act=del&id='.$cat['id'].'">Удалить</a> <a href="/adminka/category.php?act=edit&id='.$cat['id'].'">Изменить</a></div>';
}
break;
case 'view':
$isset = mysql_query("SELECT * FROM `cat` WHERE `id` = '".$id."'");
if(mysql_num_rows($isset) > 0){
$catt = mysql_fetch_array($isset);
$title = $catt['name'];
require_once ('head.php');
$count = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `category` = '".$id."' AND `status` = '1' AND `ban` = '0'"));
if($count > 0){
$total=intval(($count-1)/$page_sait)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0) $page = 1;
if($page > $total) $page = $total;
$past=intval($count/$page_sait);
$start=$page*$page_sait-$page_sait;
echo '<div class="nav">';
if($_GET['sort'] == 'hosts' OR $_GET['sort']==null) echo 'Хосты'; else echo '<a href="cat.php?act=view&id='.$id.'&sort=hosts">Хосты</a>'; echo ' | ';
if($_GET['sort'] == 'hits') echo 'Хиты'; else echo '<a href="cat.php?act=view&id='.$id.'&sort=hits">Хиты</a>'; echo ' | ';
if($_GET['sort'] == 'in') echo 'В топ'; else echo '<a href="cat.php?act=view&id='.$id.'&sort=in">В топ</a>'; echo ' | ';
if($_GET['sort'] == 'out') echo 'Из топа'; else echo '<a href="cat.php?act=view&id='.$id.'&sort=out">Из топа</a>';
echo '</div>';
if($_GET['sort'] == 'hits') $sort= 'hits';
elseif($_GET['sort'] == 'in') $sort= 'in';
elseif($_GET['sort'] == 'out') $sort= 'out';
else $sort= 'hosts';
$saits = mysql_query("SELECT * FROM `sait` WHERE `category` = '".$id."' AND `status` = '1' AND `ban` = '0' ORDER BY `".$sort."` DESC LIMIT ".$start.",".$page_sait."");
while($row = mysql_fetch_array($saits)){
$start++;
echo '<a class="link" href="/out/'.$row['id'].'.php">'.$start.') '.$row['name'].' <span class="stat">'.$row['hosts'].'/'.$row['hits'].'</span></a>';
if(mb_strlen($row['about']) > 50){
$text = mb_substr($row['about'], 0, 50, 'utf-8');
echo '<a class="link" href="/infos.php?id='.$row['id'].'">'.$text.'...</a>';
}
else echo '<a class="link" href="/infos.php?id='.$row['id'].'">'.$row['about'].'</a>';
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($count,$page_sait,$page,'cat.php?id='.$id.'&sort='.$sort.'&',$total);
}
else{
echo '<div class="text">В данной категории нет активных сайтов</div>';
}
echo '<a class="link" href="/cat.php">Категории</a>';
}
else{
$title = 'Ошибка';
require_once ('head.php');
echo '<div class="text">Данной категории несуществует</div>';
echo '<a class="link" href="/cat.php">Категории</a>';
}
break;
}
require_once ('foot.php');
?>