<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Новости';
include_once '../sys/inc/thead.php';
title();
aut(); // форма авторизации

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `news`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>\n";
if ($k_post==0)
{
echo '<div class="mess">';
echo 'Нет новостей';
echo '</div>';
}
while ($post = mysql_fetch_assoc($q))
{
/*-----------зебра-----------*/ 
if ($num==0){
	echo '<div class="nav2">';
	$num=1;
}elseif ($num==1){
	echo '<div class="nav1">';
	$num=0;
}
/*---------------------------*/
echo "<img src='/style/icons/rss.png' alt='*' /> <a href='news.php?id=$post[id]'>".htmlspecialchars($post['title'])."</a> \n";
echo "(".mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '$post[id]'"),0).")<br />";

echo "   </div>\n";
}
echo "</table>\n";
if (user_access('adm_news')){	echo "<div class='foot'>";
	echo " <img src='/style/icons/ok.gif' alt='*' />  <a href='add.php'>Создать новость</a><br />\n";	echo "</div>";
}
if ($k_page>1)str('index.php?',$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
?>
