<?php
$news_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `news`"),0);
$user_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"),0);
$user_countn = mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `time_reg` > ". (time()-43200) .""),0);
$user_on = mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `time_last` > ". (time()-600) .""), 0);
$guest_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `guest`"),0);
$guest_new_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `guest` WHERE `time` > ". (time()-86400) .""),0);
?>

<? $query = mysql_query("SELECT * FROM `news` WHERE `time` > '". (time()-60 * 60 * 24 * 30) ."' ORDER BY `time` DESC LIMIT 1");
while ($newsone = mysql_fetch_assoc($query)){

$k_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `news_comments` WHERE `news_id` = '$newsone[id]'"),0);
$knew_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `news_comments` WHERE `news_id` = '$newsone[id]' AND `time` > ". (time()-86400) .""),0);

if (string($newsone['txt']) <= 500) $news_msg = output($newsone['txt']);
else $news_msg = output(cut($newsone['txt'], 500)) .'... <a href="/scripts/news.php?komm='.$newsone['id'].'" title="Читать дальше"><b>»</b></a>';
echo '<div class="head">Главная</div>';
echo '<div class="menu_link">';
echo ' '.htmlspecialchars($newsone['name']).' </div> <div class="post0"> '.$news_msg.'<br>';

echo '<a href="/scripts/news.php?komm='.$newsone['id'].'">Комментарии</a> ['.$k_komm.''.($knew_komm > 0? ' / <font color="red">+'.$knew_komm.'</font>' : '').']';
echo '</div>';
echo '								<div class="razdel">Общее</div>
								<a class="link" href="/news/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Новости ('.$news_count.')</span></a>
								<a class="link" href="/gb/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Гостевая <span class="color">('.$guest_count.' '.($guest_new_count > 0? '/ <font color="red">+'.$guest_new_count.'</font>' : '').')</span></a>
								<a class="link" href="/user/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Пользователи <span class="color">('.$user_count.' '.($user_countn > 0? '/ <font color="red">+'.$user_countn.'</font>' : '').')</span></span></a>
											<div class="razdel2">Клиентам</div>
								<a class="link2" href="/manager"><span class="arrow"><img src="style/img/icon2.png" alt="icon" /> Вход (сервер)</span></a>
								
								<a class="link2" href="/isp/"><span class="arrow"><img src="style/img/icon2.png" alt="icon" /> ISPmanager (мобильная версия)</span></a>
					
								<a class="link2" href="/tafifs/"><span class="arrow"><img src="style/img/icon2.png" alt="icon" /> Хостинг</span></a>
								<a class="link2" href="/tafifs/dop"><span class="arrow"><img src="style/img/icon2.png" alt="icon" /> Дополнительные услуги</span></a>
											
											<div class="razdel">Информация</div>
								
								<a class="link" href="/support/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Отдел Технической поддержки</span></a>
								<a class="link" href="/server/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Конфигурация серверов</span></a>
								<a class="link" href="/rules/"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Правила хостинга</span></a>
								<a class="link" href="#"><span class="arrow"><img src="style/img/icon1.png" alt="icon" /> Способы оплаты</span></a>';
} ?>


