<?PHP
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="c89">';
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($t_f1 == 0) {
echo '<div class="podmenu"><center><b>Форум пока пуст!</b></center></div>';
}

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

if($a['status'] == 0) { 
$icon = 'tem';
}elseif($a['status'] == 1){
$icon = 'close';
}elseif($a['status'] == 2){
$icon = 'top';
}

echo '<table cols="2" width="100%" cellpadding="0" cellspacing="0" style="font-size:14px;"><tr>
<div class="menudiv" ><a href="/admforum/tema'.$a['id'].'"><img width="16" height="16" src="/images/'.$icon.'.png" alt="*" /> '.$a['name'].' ('.mysql_result(mysql_query('select count(`id`) from `admforum_post` WHERE `tema` = "'.$a['id'].'"'),0).')</a><a href="/admforum/tema'.$a['id'].'?selection=top" style="float:right;">></a></div>
</tr></table>';
}

}
##Выводим форум
$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="c89"> ';
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($t_f == 0) {
echo '<div class="podmenu"><center><b>Форум пока пуст!</b></center></div>';
}

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

if($a['status'] == 0) { 
$icon = 'tem';
}elseif($a['status'] == 1){
$icon = 'close';
}elseif($a['status'] == 2){
$icon = 'top';
}

echo '<table cellpadding="0" cellspacing="0" style="font-size:14px;">
<div class="menudiv" ><a href="/forum/tema'.$a['id'].'" class="k_menu"><img width="16" height="16" src="/images/'.$icon.'.png" alt="*" /> '.$a['name'].' ('.mysql_result(mysql_query('select count(`id`) from `forum_post` WHERE `tema` = "'.$a['id'].'"'),0).')</a>                            <a href="/forum/tema'.$a['id'].'?selection=top" style="float:right;">></a></div>
</table>';
}
$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="c89"> ';
echo '<a href="'.$HOME.'/down/"> Загрузки ('.$df.' <span style="color: #61b565"><b>+ '.$ndf.'</b></span></a>)';
echo '</div>';
##последние файлы
$file = mysql_result(mysql_query('select count(`id`) from `load_file`'),0); 
 if($file >= 1)
{
$file_t = mysql_query("SELECT * FROM `load_file` ORDER BY `time` DESC LIMIT 3");
 while($load = mysql_fetch_assoc($file_t))
{
echo '<div class="menudiv">';
echo '<a class="k_menu" href="'.$HOME.'/down/file'.$load['id'].'"><img src="'.$HOME.'/images/load/'.$load['format'].'.png" alt="*" /> '.$load['name'].' </a>';
echo '</div>';
}
}
else{
echo '<div class="podmenu"><center><b>Нет файлов</b></center></div>';
} 
$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="c89"> ';

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

##последние коды
$file = mysql_result(mysql_query('select count(`id`) from `cod_stat`'),0); 
 if($file >= 1)
{
$file_t = mysql_query("SELECT * FROM `cod_stat` ORDER BY `time` DESC LIMIT 3");
 while($load = mysql_fetch_assoc($file_t))
{
echo '<div class="menudiv">';
echo '<a class="k_menu" href="'.$HOME.'/cod/stat_'.$load['id'].'"> '.$load['titlename'].' </a>';
echo '</div>';
}
}
else{
echo '<div class="podmenu"><center><b>Нет кодов</b></center></div>';
} 

$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="c89"><a href="/m">Магазин</a> ('.$con.' <font color="red">+ '.$cnm.'</font>)</div>';

$good = mysql_query("SELECT * FROM `shop_goods` ORDER BY `id` DESC LIMIT 0, 3");

while($g = mysql_fetch_assoc($good))
{
	$g['description']=substr($g['description'], 0, 200);
	$g['description']=rtrim($g['description'], "!,.-");
echo '<div class="podmenu"><a href="/m/tovar.php?id='.$g['id'].'">'.$g['name'].'</a> (<b>Стоит: <font color="green">'.$g['price'].' руб.</font></b>)<br/></div>';

}
?>