File size: 2.56Kb
<? include("head.php");
if(!isset($_SESSION['user_id']))echo '<div class="menu">Авторизация<br/><form action="auth.php" method="post">Логин <input name="auth_name" type="text" /><br/>Пароль <input name="auth_pass" type="password" /> <input name="" type="submit" value="Вход" /></form><br/><a href="reg.php">Регистрация</a></div>';
else if($me['admin'] ==2)echo "<a href='admin/index.php'>Админ-меню</a><br/>";
if(isset($me))echo "<a href='my.php'>Кабинет</a>";
$new_q=mysql_query("SELECT * FROM `sh_new` ORDER BY `time` DESC LIMIT 1");
while($new=mysql_fetch_array($new_q))
{echo "<div class='menu'><b>Последняя новость:</b><br/><a href='new.php?id=$new[id]'>$new[name]</a><br/><small>$new[description]</small></div>";
}
$cat_q=mysql_query("SELECT * FROM `sh_cat`");
echo "<div class='menu'><b>Форумы:</b><br/>";
while($cat=mysql_fetch_array($cat_q))
{$num_pod=mysql_num_rows(mysql_query("SELECT * FROM `sh_podcat` WHERE `refid`=$cat[id]")); echo "<a href='cat.php?id=$cat[id]'>$cat[name]</a> [$num_pod/$cat[tem]/$cat[post]]<br>";}echo "</div>";
$actual_q=mysql_query("SELECT * FROM `sh_tem` WHERE `close`=0 ORDER BY `time` DESC LIMIT 5");
echo "<div class='menu'><b>Актуальные темы:</b><br/>";
while($actual=mysql_fetch_array($actual_q)){
$posl_post=mysql_fetch_array(mysql_query("SELECT * FROM `sh_post` WHERE `tema`='$actual[id]' ORDER BY `date` DESC"));
$postov=mysql_num_rows(mysql_query("SELECT * FROM `sh_post` WHERE `tema`='$actual[id]' ORDER BY `date` DESC"));
$us_av=mysql_query("SELECT * FROM `sh_user` WHERE `id`='$posl_post[avtor]'");
$user_avtor=mysql_fetch_array($us_av);
$posl_post['date']=str_replace(date("Y.m.d"), "Сегодня", $posl_post['date']);
echo "<a href='tema.php?id=$actual[id]'>$actual[name]</a> ($postov) Последний: [$posl_post[date] ";
if(mysql_num_rows($us_av)==1)echo "От: $user_avtor[echologin]]<br/>";
else echo "От: DELETED#$posl_post[avtor]]<br/>";}
echo "</div><div class='menu'><b>Статистика:</b><br/>Пользователей: ".mysql_num_rows(mysql_query("SELECT * FROM `sh_user`"))."<br/>
Форумов: ".mysql_num_rows(mysql_query("SELECT * FROM `sh_cat`"))."<br/>
Категорий: ".mysql_num_rows(mysql_query("SELECT * FROM `sh_podcat`"))."<br/>
Тем: ".mysql_num_rows(mysql_query("SELECT * FROM `sh_tem`"))."<br/>
Сообщений: ".mysql_num_rows(mysql_query("SELECT * FROM `sh_post`"))."</div>";
echo "<small>Design by INFERNO (wapdiz.ru)<br/>Script by SHuRiK(forum.r1v.ru)</small>";
include("foot.php");?>