<?
$num=1;
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';
?>
<?
if(isset($_GET['edit']))
{
include_once 'edit.php';
}
if(isset($_GET['delete']))
{
include_once 'delete.php';
}
elseif(isset($_GET['edit_komm']))
{
include_once 'edit_komm.php';
}
elseif(isset($_GET['new']))
{
include_once 'new.php';
}
elseif(isset($_GET['new_komm']))
{
include_once 'komm.php';
}
elseif(isset($_GET['add']))
{
include_once 'add.php';
}
else
{
$set['title']='Новости';
include_once '../../sys/inc/thead.php';
title();
aut(); // форма авторизации
$set['p_str']=10;
$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]");
if ($k_post==0)
{
echo " <tr>\n";
echo " <td class='p_t'>\n";
echo "Нет новостей\n";
echo " </td>\n";
echo " </tr>\n";
}
while ($post = mysql_fetch_assoc($q))
{
echo "<div class='main'><img src='img/rss.png'/> <b><a href='?new=$post[id]'>".htmlspecialchars($post['title'])."</a></b>(".mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '$post[id]'"),0).")\n";
echo"</b></font>\n";
echo "<font color='green'>".vremja($post['time'])."</font></div>\n";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
if($user['level']>2)echo "<div class='foot'><img src='img/add.png'/> <a href='?add=mod'>Добавить новость</a></div>";
include_once '../../sys/inc/tfoot.php';
}
?>