File size: 2.27Kb
<?php
include('inc/funct.php');
include('inc/funct_index.php');
include('inc/core.php');
if (empty($_GET['cat'])) {
redirect(URL);
die();
} else $cat = htmlspecialchars($_GET['cat']);
$cat = mysql_fetch_object(mysql_query('SELECT * FROM `categories` WHERE id='.$cat.''));
$pagetitle = 'Категория '.$cat->title.'';
include('inc/header.php');
echo '<div id="title_a">'.$pagetitle.'</div>';
$lastid = mysql_fetch_array(mysql_query('SELECT MAX(ID) FROM `sites` WHERE category='.$cat->id.' AND status=1'));
$count = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `sites` WHERE category='.$cat->id.' AND status=1'));
if ($count[0]==0) {
echo 'В данной категории еще нет сайтов';
die();
}
if (empty($_GET['p'])) $p = 1;
else $p = htmlspecialchars($_GET['p']);
if ($p<=0) $p = 1;
$end = $p*10;
$start = $end-10;
$sort = '`reit` DESC';
$result = mysql_query('SELECT * FROM `sites` WHERE category='.$cat->id.' AND status=1 ORDER BY '.$sort.' LIMIT '.$start.', 10');
echo '<div id="menu"><ul>';
while ($site = mysql_fetch_object($result))
{
echo '<li><a href="site.php?id='.$site->id.'">'.$site->name.'</a></li>
<div class="desc">'.cut_string($site->description,20).'</div>';
if ($site->reit <= minreit) {
echo 'URL: <a href="go.php?id='.$site->id.'">'.$site->URL.'</a>
<hr color="#b8ccf4">';
} else {
echo 'URL: <a href="'.$site->URL.'">'.$site->URL.'</a>
<hr color="#b8ccf4">';
}
}
echo '</ul></div>';
$prev = $p-1;
$next = $p+1;
$last = $count[0]/10;
if (!is_int($last)) $last = ceil($last);
echo '<div align="center">';
if ($p!=1) echo '<a href="view.php?cat='.$cat->id.'&p=1"><img src="images/first.png" /></a> ';
else echo '<img src="images/first.png" /> ';
if ($p!=1) echo '<a href="view.php?cat='.$cat->id.'&p='.$prev.'"><img src="images/prev.png" /></a> ';
else echo '<img src="images/prev.png" />';
if ($p!=$last) echo '<a href="view.php?cat='.$cat->id.'&p='.$next.'"><img src="images/next.png" /></a> ';
else echo '<img src="images/next.png" /> ';
if ($p!=$last) echo '<a href="view.php?cat='.$cat->id.'&p='.$last.'"><img src="images/last.png" />';
else echo '<img src="images/last.png" />';
echo '</div>';
echo 'Всего сайтов в категории: <b>'.$count[0].'</b>';
include('inc/footer.php');
?>