<?php

/*
-----------------------------------------
Автор:Shunia22 -=КотЭ=-(-=MTV=-) и Shot(Robber)
Бесплатный WAP движок: Strongcms
Контакты: 0664452670(МТС) ибо ICQ(7296000)
Файл: index.php
-------------------------------------------
*/
//-----Создаем титл страницы-----//
$title = 'Главная';
//-----Подключаем функции-----//
require_once ('system/function.php');
//-----Подключаем вверх-----//
require_once ('system/header.php');
//-----Выводим логотип----//
echo '<div class="logo"><center><img src="'.$HOME.'/design/gradient/logo.png" alt="'.$HOME.'" title="'.$HOME.'" /></center></div>';
if(!$user['id']) {echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><div class="divmenu">Меню гостя : Добро пожаловать, Гость!</div></div>';
} else {
echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><div class="divmenu">Меню пользователя:</div></div>';

/* Вывод новых оповещений */
if($len != 0) {
echo '<div class="menudiv"><a href="'.$HOME.'/lenta.php" class="k_menu">
<img width="10" height="10" src="'.$HOME.'/images/lentahome.png" alt="*" title="Лента" /> Лента ('.$len.')
</div></a>';
}

/* Вывод новых сообщений */
if($mes != 0) {
echo '<div class="menudiv"><a href="'.$HOME.'/mes" class="k_menu">
<img width="10" height="10" src="'.$HOME.'/images/message.png" alt="*" title="Почта" /> Почта ('.$mes.')
</div></a>';
}

echo '<div class="menudiv"><a href="'.$HOME.'/user/cab.php" class="k_menu">
<img width="10" height="10" src="'.$HOME.'/images/cab.png" alt="*" title="Личный кабинет" /> Личный кабинет
</div></a>
<div class="menudiv"><a href="'.$HOME.'/exit.php" class="k_menu">
<img width="10" height="10" src="'.$HOME.'/images/exit.png" alt="*" title="Выход" /> Выход
</div></a>';
}

//-----Выводим новости-----//
$count_news = mysql_result(mysql_query('select count(`id`) from `news`'),0);
echo '<div class="news">
<div class="divnews">
<img width="10" height="10" src="'.$HOME.'/images/rss.png" alt="Новости" title="Новости" /> <a href="'.$HOME.'/news/">Новости</a> ('.$count_news.')<br />';
$sql = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1");
while($sql1 = mysql_fetch_assoc($sql))
{
echo ''.smile(bb($sql1['text'])).'<br />
<img src="'.$HOME.'/images/rek.png" alt="*" /> Автор: '.nick($sql1['avtor']).'<br />
<img src="'.$HOME.'/images/rek.png" alt="*" /> <a href="/news/comment'.$sql1['id'].'">Комментарии:</a> ('.mysql_result(mysql_query('select count(`id`) from `news_com` where `news` = "'.$sql1['id'].'"'),0).')';
}
echo '</div></div>';

//-----Выводим форум-----//
$t_f = mysql_result(mysql_query('select count(`id`) from `forum_tema`'),0);
echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><a href="'.$HOME.'/forum/"><div class="divmenu"><font color="red">Форум</font></a></div><div class="count"> ('.$t_f.' <font color="red"><b>+'.mysql_result(mysql_query('select count(`id`) from `forum_tema` where `time` > "'.(time()-((60*60)*24)).'"'),0).'</b></font> | '.mysql_result(mysql_query('select count(`id`) from `forum_post`'),0).' <font color="green"><b>+'.mysql_result(mysql_query('select count(`id`) from `forum_post` where `time` > "'.(time()-((60*60)*24)).'"'),0).'</b></font> )</div></div>';

if($t_f == 0) {
echo '<div class="podmenu"><center><b>Форум пока пуст!</b></center></div>';
}

$forum = mysql_query("SELECT * FROM `forum_tema` ORDER BY `up` DESC LIMIT 4");
while($a = mysql_fetch_assoc($forum))
{

if($a['status'] == 0) {
$icon = 'tem'; } else { $icon = 'close';
}

echo '<table cols="2" width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;"><tr>
<td class="menudiv" width="95%"><a href="/forum/tema'.$a['id'].'" class="k_menu"><img src="/images/'.$icon.'.png" alt="*" /> '.$a['name'].' ('.mysql_result(mysql_query('select count(`id`) from `forum_post` WHERE `tema` = "'.$a['id'].'"'),0).') </a></td>
<td class="menudiv" style="text-align:center;"  width="10%"><a href="/forum/tema'.$a['id'].'?selection=top" class="k_menu"><b>></b></a></td>
</tr></table>';
}
//-----Выводим меню сайта-----//
echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><div class="divmenu">Меню сайта:</div></div>
<!--//<div class="menudiv"><a href="'.$HOME.'/down/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/down.png" alt="*" title="Загрузки" /> Загрузки <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `load_file`"),0).')</div></div></a> //-->
<div class="menudiv"><a href="'.$HOME.'/php_lsn/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/lib.png" alt="*" title="Учебник" /> Учебник по php</div></a>
<div class="menudiv"><a href="'.$HOME.'/info/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/chat.png" alt="*" title="Инфа" /> Информация</div></a>
<div class="menudiv"><a href="'.$HOME.'/newspaper/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/online.png" alt="*" title="Газета" /> Газета <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `newspaper_paper`"),0).')</div></div></a>

<div class="menudiv"><a href="'.$HOME.'/lib/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/lib.png" alt="*" title="Библиотека" /> Библиотека <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `lib_stat`"),0).')</div></div></a>
<div class="menudiv"><a href="'.$HOME.'/photo" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/photos.png" alt="Чат" title="Фотоальбомы" /> Фотоальбомы <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `photo_files`"),0).')</div></div></a>
<div class="menudiv"><a href="'.$HOME.'/blog/" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/blog.png" alt="*" title="Блоги" /> Блоги <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `blog_stat`"),0).')</div></div></a>
<div class="menudiv"><a href="'.$HOME.'/guest" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/guest.png" alt="Беседка" title="Беседка" /> Беседка <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `guest`"),0).')</div></div></a>
<div class="menudiv"><a href="'.$HOME.'/chat" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/chat.png" alt="Чат" title="Чат" /> Чат <div class="count_m">('.mysql_result(mysql_query("SELECT COUNT(id) FROM `chat_post`"),0).')</div></div></a>';

echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><div class="divmenu">Информация:</div></div>
<div class="menudiv"><a href="'.$HOME.'/online.php" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/online.png" alt="Сейчас онлайн" title="Сейчас онлайн" /> Сейчас онлайн ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `viz` > '".(time()-360)."'"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/administration.php" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/security.png" alt="Администрация сайта" title="Администрация сайта" /> Администрация сайта ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `level` >= '1'"),0).')</div></a>
<div class="menudiv"><a href="'.$HOME.'/user.php" class="k_menu"><img width="15" height="15" src="'.$HOME.'/images/user.png" alt="Пользователи" title="Пользователи" /> Пользователи ('.mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"),0).')</div></a>';
//--Загрузки--//
echo '
<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><a href="'.$HOME.'/down/"><div class="divmenu"><font color="red">Загрузки</font></a></div><div class="count"> ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `load_file`"),0).' <font color="red"><b>+ '.mysql_result(mysql_query('select count(`id`) from `load_file` where `time` > "'.(time()-((60*60)*24)).'"'),0).' </b></font>)</div></div></a>';
 $l_f = mysql_result(mysql_query('select count(`id`) from `load_file`'),0);
if($l_f >= 1)
{
$load_r = mysql_query("SELECT * FROM `load_file` ORDER BY `time` DESC LIMIT 4");
while($load = mysql_fetch_assoc($load_r))
{
echo '<div class="menudiv"> <a href="'.$HOME.'/down/file'.$load['id'].'" class="k_menu">'.$load['name'].' </div></div></a>';

}
}else{
echo '<div class="links"><center><b>Файлов пока нет!</b></center></div>';
}
//-----Подключаем низ и рекламу-----//
$rek = mysql_result(mysql_query("SELECT COUNT(id) FROM `ads` WHERE `time_srok` > '".time()."' "),0);
$sql_rek = mysql_query("SELECT * FROM `ads` WHERE `time_srok` > '".time()."' ORDER BY rand() ");

if($rek != 0) {
echo '<div class="menu"><img src="'.$HOME.'/design/gradient/lol.png" alt="*" /><div class="divmenu">Рекламма:</div></div></div>';

while($sql = mysql_fetch_assoc($sql_rek))
{
echo '<div class="menudiv"><a href="'.$sql['url'].'" class="k_menu"> '.$sql['name'].'</div></a>';
}
}
require_once ('system/footer.php');
?>