<?php
## Выводим новости
$count_news = mysql_result(mysql_query('select count(`id`) from `news`'),0);
if(!empty($user['news']) != $count_news)
{
echo '<div class="menu">';
echo '<a href="'.$HOME.'/news/">Новости</a> ('.$count_news.')';
echo '</div>';
echo '<div class="news">';
$sql = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1");
while($sql1 = mysql_fetch_assoc($sql))
{
echo '<div class="new">';
echo ''.nl2br(smile(bb($sql1['text']))).'<br />
Добавил: '.nick($sql1['avtor']).'<br />
<a href="/news/comment'.$sql1['id'].'">Комментарии:</a> ('.mysql_result(mysql_query('select count(`id`) from `news_com` where `news` = "'.$sql1['id'].'"'),0).')';

if(isset($user['id'])) {
echo '<br /><a href="?news='.$sql1['id'].'">Скрыть новость</a>';}
echo '</div >';
if(isset($_GET['news'])){
$news= trim(intval($_GET['news']));
mysql_query("UPDATE `users` SET `news` = '".$news."' WHERE `id` = '".$user['id']."'");
header('Location: '.$HOME.'');
}}
} else{
echo '<div class="menu">
<a href="'.$HOME.'/news/">Новости</a> ('.$count_news.')</div>';}
echo '</div></div>';

if($user['level'] >= 1)
{
$t_f1 = mysql_result(mysql_query('select count(`id`) from `admforum_tema`'),0);
$p_f1 = mysql_result(mysql_query('select count(`id`) from `admforum_post`'),0);
$ntf1 = mysql_result(mysql_query('select count(`id`) from `admforum_tema` where `time` > "'.(time()-((60*60)*24)).'"'),0);
$npf1 = mysql_result(mysql_query('select count(`id`) from `admforum_post` where `time` > "'.(time()-((60*60)*24)).'"'),0);

echo '<div class="menu">';
echo '<a href="'.$HOME.'/admforum/"> Админ Форум ('.$t_f1.'/'.$p_f1.')(<font color="red"><b>+'.$ntf1.'</b></font> / <font color="green"><b>+'.$npf1.'</b></font>)</a>';
echo '</div>';
##последние темы форума
if (!isset($user['id'])){
require_once ('system/admforum.php');   
}else{
if ($user['new_tem']== 0)
require_once ('system/admforum.php');
}
}

##Выводим форум
$t_f = mysql_result(mysql_query('select count(`id`) from `forum_tema`'),0);
$p_f = mysql_result(mysql_query('select count(`id`) from `forum_post`'),0);
$ntf = mysql_result(mysql_query('select count(`id`) from `forum_tema` where `time` > "'.(time()-((60*60)*24)).'"'),0);
$npf = mysql_result(mysql_query('select count(`id`) from `forum_post` where `time` > "'.(time()-((60*60)*24)).'"'),0);

echo '<div class="menu">';
echo '<a href="'.$HOME.'/forum/"> Форум</a> ('.$t_f.'/'.$p_f.')(<font color="red"><b>+'.$ntf.'</b></font> / <font color="green"><b>+'.$npf.'</b></font>)';
echo '</div>';
##последние темы форума
if (!isset($user['id'])){
require_once ('system/new_tem.php');   
}else{
if ($user['new_tem']== 0)
require_once ('system/new_tem.php');
}


##Выводим файлы 
$df = mysql_result(mysql_query("SELECT COUNT(id) FROM `load_file`"),0);
$ndf = mysql_result(mysql_query('select count(`id`) FROM `load_file` WHERE `time` > "'.(time()-((60*60)*24)).'"'),0);

echo '<div class="menu">';
echo '<a href="'.$HOME.'/down/"> Загрузки ('.$df.' <span style="color: #61b565"><b>+ '.$ndf.'</b></span></a>)';
echo '</div>';
##последние файлы
if (!isset($user['id'])){
require_once ('system/new_files.php');
}else{
if ($user['new_files']== 0)
require_once ('system/new_files.php');
}
$df1 = mysql_result(mysql_query("SELECT COUNT(id) FROM `cod_stat`"),0);
$ndf1 = mysql_result(mysql_query('select count(`id`) FROM `cod_stat` WHERE `time` > "'.(time()-((60*60)*24)).'"'),0);
echo '<div class="menu">';

echo '<a href="'.$HOME.'/cod/"> Полезные коды ('.$df1.' <span style="color: #61b565"><b>+ '.$ndf1.'</b></span></a>)';
echo '</div>';

##последние коды
if (!isset($user['id'])){
require_once ('system/new_cod.php');
}else{
if ($user['new_files']== 0)
require_once ('system/new_cod.php');
}
$time=time()-864000;
$con=mysql_num_rows(mysql_query("SELECT * FROM `shop_goods`"));
$cnm=mysql_num_rows(mysql_query("SELECT * FROM `shop_goods` WHERE `time`>".$time.""));
echo '<div class="menu"><a href="/m">Магазин</a> ('.$con.' <font color="red">+ '.$cnm.'</font>)</div>';
require_once ('m/new_goods.php');
##Выводим меню сайта
echo '<div class="menu">Меню сайта:</div>';

$nf = mysql_result(mysql_query('select count(`id`) from `photo_files` where `time` > "'.(time()-((60*60)*24)).'"'),0);

echo '
<div class="menudiv"><a href="'.$HOME.'/guest" class="k_menu"> Гостевая ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `guest`"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/birga/" class="k_menu"> Биржа труда ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `birga`"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/user/doska.php" class="k_menu"> Доска позора ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `ked_list`"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/user/pochet.php" class="k_menu"> Доска почетных ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `pochet`"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/static/" class="k_menu"> Статистика </a></div>
<div class="menudiv"><a href="'.$HOME.'/online.php" class="k_menu"> Сейчас на сайте ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `viz` > '".(time()-3600)."'"),0).'/'.mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `time` > '".(time()-300)."'"),0).')</a></div>
';
?>