Файл: journal/category.php
Строк: 35
<?php
//-----Создаем титл страницы-----//
$title = 'Газета';
//-----Подключаем функции-----//
require_once ('../system/function.php');
//-----Подключаем вверх-----//
require_once ('../system/header.php');
$id = abs(intval($_GET['id']));
$section = mysql_fetch_assoc(mysql_query("SELECT * FROM `category` WHERE `id` = '".$id."'"));
if(!$section)
{
echo '<div class="menu">Ошибка</div><div class="podmenu"><center><b>Категории не существует.</b></center></div>';
require_once ('../system/footer.php');
exit();
}
echo '<div class="menu"><center>'.$section['title'].'</center></div>';
$count_article = mysql_result(mysql_query("SELECT COUNT(*) FROM `article` WHERE `id_category` = '".$section['id']."'"), 0);
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post = $count_article;
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
if ($count_article != 0)
{
$result = mysql_query("SELECT * FROM `article` WHERE `id_category` = '".$section['id']."' ORDER BY `id` DESC LIMIT $start, $max");
while ($article = mysql_fetch_assoc($result)) {
$author = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$article['us_id']."'"));
echo '<div class="podmenu"><a href="article.php?id='.$article['id'].'">'.$article['title'].'</a><br />Опубликовал: <a href="/user_'.$article['us_id'].'">'.$author['login'].'</a></div>';
}
}
else
{
echo '<div class="podmenu">Новостей пока нет!</div>';
}
if ($k_page>1) echo str('/journal/category.php?id='.$section['id'].'&',$k_page,$page);
if($user['level']>2){
echo '<div class="podmenu">
» <a href="/panel/journal_category.php?act=edit&id='.$section['id'].'">Изменить</a><br/>
» <a href="/panel/journal_category.php?act=del&id='.$section['id'].'">Удалить</a>
</div>';
}
//-----Подключаем низ-----//
require_once ('../system/footer.php');
?>