File size: 5.42Kb
<?php
define('PROTECTOR', 1);
$head = 'forum';//фикс. места
$path = '../'; //путь
$textl = 'Форум';
@include($path.'files/db.php');
@include($path.'files/auth.php');
@include($path.'files/func.php');
@include($path.'files/core.php');
@include('head.php');
//если бан
$req = mysql_query("SELECT * FROM `ban` WHERE `usr` = '$log' LIMIT 1");
// //////////////////////////
$avto = mysql_num_rows($req);
if ($avto == 1) {
$ban = mysql_fetch_array($req);
echo"$div <font color='red'> Ваш персонаж забанен! Доступ на форум закрыт!<br> Осталось: ";
$ban[ban_time]=$ban[ban_time]-time();
if($ban[ban_time]<60){
echo "$ban[ban_time] сек.</font>";
}elseif($ban[ban_time]>60 and $ban[ban_time]<3600){
$ban[ban_time]=round($ban[ban_time]/60);
echo "$ban[ban_time] мин.<br>";
}elseif($ban[ban_time]>3600 and $ban[ban_time]<86400){
$ban[ban_time]=round($ban[ban_time]/3600);
echo "$ban[ban_time] часов.<br>";}
else{
$ban[ban_time]=round($ban[ban_time]/86400);
echo "$ban[ban_time] суток.<br>";
}
echo "Забанил: $ban[admin]</br></font>";
include($path.'files/end.php');exit;}
//конец бана
echo'<div class="nevbb">';
switch($_GET['act']){
###############################################################################
## Главная страница, список разделов ##
###############################################################################
default:
$time=time();
echo "<center><b>Разделы</b></center></div><div class='menuList'>";
$result = mysql_query("SELECT * FROM `forum_cats` WHERE `id_cat` = 0");
while($cat = mysql_fetch_assoc($result)){
$topics = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_topics` WHERE `id_cat` = '".$cat['id']."'"), 0);
$msg = mysql_query("SELECT * FROM `forum_msg` WHERE `id_cat` = '".$cat['id']."'");
$avto=mysql_num_rows($msg);
$vr=$time-86000;
$msg = mysql_query("SELECT * FROM `forum_msg` WHERE `id_cat` = '".$cat['id']."' and `time`>'$vr'");
$avtom=mysql_num_rows($msg);
if($avtom>0){$new = "+$avtom";}else{$new="";}
echo '<li><a href="index.php?act=cat_view&id='.$cat['id'].'"> <img src="pic/main/fo.gif" alt="*"/> '.$cat['name'].' ('.$topics.'/'.$avto.''.$new.')</a></li>';
}
echo"</div>
";
break;
###############################################################################
## Просмотр раздела ##
###############################################################################
case 'cat_view':
$id = intval($_GET['id']);
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_cats` WHERE `id` = '$id'"));
if(isset($row['id'])){
echo '<center><b>'.$row['name'].'</b></center></div>';
$count_subcats = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_cats` WHERE `id_cat` = '$id'"), 0);
if($count_subcats > 0){
$result_subcats = mysql_query("SELECT * FROM `forum_cats` WHERE `id_cat` = '$id'");
while($subcat = mysql_fetch_assoc($result_subcats)){
$topics = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topics` WHERE `id_cat` = ".$subcat['id'].""), 0);
$msg = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_msg` WHERE `id_cat` = ".$subcat['id'].""), 0);
echo '<a href="?act=cat_view&id='.$subcat['id'].'">'.$subcat['name'].'</a> ('.$topics.'/'.$msg.')<br/>';
}
echo '</div><div class="menu">';
}else{echo '</div><div class="menuList">';
$count_topics = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topics` WHERE `id_cat` = '$id'"), 0);
if($count_topics > 0){
$pages = ceil($count_topics/10);
if(isset($_REQUEST['page'])){
$page = num($_REQUEST['page']);
}else{
$page = 1;
}
$from = ($page-1)*10;
$result_topics = mysql_query("SELECT * FROM `forum_topics` WHERE `id_cat` = '$id' ORDER BY `time` DESC LIMIT $from, 20");
while($topic = mysql_fetch_assoc($result_topics)){
$time=time();
$vr=$time-86000;
$msgn = mysql_query("SELECT * FROM `forum_msg` WHERE `id_topic` = '".$topic['id']."' and `time`>'$vr'") or die(mysql_error());
$avtom=mysql_num_rows($msgn);
if($avtom>=1){$new = "+$avtom";}else{$new="";}
$msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_topic` = '".$topic['id']."'"), 0);
$last_user = mysql_fetch_assoc(mysql_query("SELECT `login` FROM `forum_msg` WHERE `id_topic` = '".$topic['id']."' ORDER BY `time` DESC LIMIT 1"));
$last_page = ceil($msg/10);
if($topic['closed'] == 0){$icotheme = "open.png";}else{$icotheme = "closed.png";}
echo '<li> <a href="topic.php?id='.$topic['id'].'"><img src="pic/'.$icotheme.'"> '.$topic['title'].'<font color="white"> ('.$msg.''.$new.') '.$last_user['login'].' »</font></a></li>';
}
}else{
echo '<center><div class=dot>В этом разделе пока нет сообщений<br/>Щёлкните <b>Новая тема</b> и ваше сообщение станет первым!</div></center>';
}
echo '<div class=nevb><center><a href="posting.php?act=topic_add&id='.$id.'">Новая тема</a></center></div>';
}
}else{
echo'Такого раздела не существует!';
}
break;
}
echo'</div><div class=evento><div class="menu" align="center"><a href="http://igru6ek.ru"> <img src="igru6ek.jpg" alt="*"/></a></div><div class="nevb">';
echo '<a href="../"><div class="zag">Главная</div></a> <a href="./"><div class="zag">Форум</div></a></div>';
echo'</div>';
@include($path . 'files/end.php');
?>