Файл: cat.php
Строк: 77
<?php
define('MTOP', 1);
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
switch($act){
default:
$title = 'Категории';
require_once ('head.php');
echo '<div class="title2"><b>Категории</b></div>';
$gold = mysql_query('SELECT * FROM `sait` WHERE `status` = "1" AND `ban` = "0" AND `gold` > "'.time().'" ORDER BY RAND() LIMIT 2');
while($row=mysql_fetch_array($gold)){
echo '<div class="lt"><small><b><font color="#CE0025">G</font><font color="#8A006F">O</font><font color="#4600B9">L</font><font color="#2400DE">D</font></b></small> <a href="/out.php?id='.$row['id'].'" rel="nofollow" target="_blank" title="Посетить wap сайт '.$row['url'].'"><b>'.$row['url'].'</b></a><br/>'.$row['about'].'<br/></div>';
}
$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 `hosts` > '0'"));
if($cat['id'] != 4) {
echo '<div class = "lt"><a href = "/m/category/view/'.$cat['id'].'"><img src="/style/img/index/icon.png" alt="yamus"> '.$cat['name'].'</a> ('.$count_sites.')</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');
echo '<div class="title"><a href="/m/category">Категории</a> | '.$catt['name'].'</div>';
$gold = mysql_query('SELECT * FROM `sait` WHERE `status` = "1" AND `ban` = "0" AND `gold` > "'.time().'" ORDER BY RAND() LIMIT 2');
while($row=mysql_fetch_array($gold)){
echo '<div class="lt"><small><b><font color="#CE0025">G</font><font color="#8A006F">O</font><font color="#4600B9">L</font><font color="#2400DE">D</font></b></small> <a href="/out.php?id='.$row['id'].'" rel="nofollow" target="_blank" title="Посетить wap сайт '.$row['url'].'"><b>'.$row['url'].'</b></a><br/>'.$row['about'].'<br/></div>';
}
$count = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `category` = '".$id."' AND `status` = '1' AND `hosts` > '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;
$saits = mysql_query("SELECT * FROM `sait` WHERE `category` = '".$id."' AND `status` = '1' AND `ban` = '0' AND `hosts` > '0' ORDER BY `hosts` DESC LIMIT ".$start.",".$page_sait."");
echo '<table style="background: #ECEBE7;" width="100%">';
while($row = mysql_fetch_array($saits)){
$start++;
if($row['id'] == $_GET['id_site']) {
$red = '<font color="red">'.$row['url'].'</font>';
} else {
$red = $row['url'];
}
echo '<tr><td class="lt" width="10px"><div class="number_top"><center>'.$start.'</center></div></td><td class="lt"> <a href="/out.php?id='.$row['id'].'" rel="nofollow" target="_blank" title="Посетить wap сайт '.$row['url'].'"><b>'.$red.'</b></span></a> <font color="green">'.$row['hits'].'</font> / <font color="red">'.$row['hosts'].'</font> <a href="/stats/'.$row['id'].'"><img src="/style/img/ico-stat.png" alt="yamus" title="Статистика сайта"></a><br/>';
if(mb_strlen($row['about']) > 150){
$text = mb_substr($row['about'], 0, 150, 'utf-8');
echo ''.$text.'..';
}
else
{
echo ''.$row['about'].'..';
}
}
echo '<br/></td></tr>';
echo '</table>';
navigation($count,$page_sait,$page,'cat.php?id='.$id.'&sort='.$sort.'&',$total);
}
else{
echo '<div class="main">В данной категории нет активных сайтов</div>';
}
}
else{
$title = 'Ошибка';
require_once ('head.php');
echo '<div class="title3">Ошибка</div>';
echo '<div class="title"><center>Данной категории не существует</center></div>';
}
break;
}
require_once ('foot.php');
?>