<?php

require '../system/start.php';
require '../system/functions.php';
$str['mesto'] = 'Новости';
$str['block'] = $set['site'].' / Новости';
include '../style/'.$style.'/head.php';
$query = mysql_query("select * from `news` order by `id` desc limit ".$page.",".$set['str']."");
$total = mysql_result(mysql_query("select count(*) from `news`"),0);
$news = mysql_result(mysql_query("select count(*) from `users` where `where` = 'Новости' and time > ".(time()-300).""),0);
if ($total == 0)
{
    echo '<div class="forum1">Новостей еще нет!</div>';
}
while ($row = mysql_fetch_assoc($query))
{
    $i++;
	if($i%2)
	{
		echo '<div class="forum1">';
	} else
	{
		echo '<div class="forum2">';
	}
	echo '<img class="ico" src="../style/'.$style.'/ico/news.gif" alt="" /> Тема дня: '.$row['title'].' ('.clock($row['time']).']<br/>Новость: '.text($row['text']).'<div class="ftext"><img class="ico" src="../style/'.$style.'/ico/comments.png" alt="" /> <a href="comments.php?id='.$row['id'].'">Обсудить ['.mysql_result(mysql_query("select count(*) from `news_comments` where `id_news` = ".$row['id'].""),0).')</a><br/></div></div>';
}
if($total > $set['str'])
{
	pages($page, $total, '?', $set['str']);
}
if ($user)
{
echo '<div class="where">В новостях '.$news.' чел</div>';
}
include '../style/'.$style.'/foot.php';
?>