Файл: sumerki.mobi/sumerki.mobi/forum/index.php
Строк: 47
<?php
//////////////////////////////////////////////////////////////
////////////////////// "Сумерки"///////////////////
//////////////////////Основатель: Mc Laren////////////////////
///////////////////Контакты: ICQ - 597687549//////////////////
/////////////////////Пример: Sumerki.Mobi/////////////////////
///////////Если ты это читаешь, значит скрипт слили :D////////
//////////////////////////////////////////////////////////////
define('PROTECTOR', 1);
$path = '../'; //путь
$textl='Сумеречный форум';
include('files/path.php');
include('files/gzips.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
echo'<div class="gameBorder">';
echo'<div class="menu">';
switch($_GET['act']){
###############################################################################
## Главная страница, список разделов ##
###############################################################################
default:
echo'<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">Форум</div><div class="clearFix"></div></div></div></div>';
$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_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id_cat` = '".$cat['id']."'"), 0);
echo '<div class="button pad_bot_5 pad"><a href="index.php?act=cat_view&id='.$cat['id'].'">    <img src="/theme/standart/images/galochka.png"/> '.$cat['name'].' ('.$topics.'/'.$msg.')</a></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 '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo ''.$row['name'].'';
echo '</div><div class="clearFix"></div></div></div></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>';
}else{
$count_topics = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topics` WHERE `id_cat` = '$id'"), 0);
if($count_topics > 0){
$pages1=$count_topics/10;
$pages = ceil($count_topics/10);
if($pages1>$pages){
$pages=$pages+1;
}
if(isset($_GET['page'])){
$page = intval($_GET['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, 10");
while($topic = mysql_fetch_assoc($result_topics)){
$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);
echo '<div class="button pad_bot_5 pad">';
echo '<a href="topic.php?id='.$topic['id'].'">';
echo '    ';
if($topic['closed'] == 0){
}else{
echo '<img width="18" height="18" src="/theme/diz/images/forum_closed.png"/> ';
}
echo ''.$topic['title'].' ('.$msg.')</a>';
echo '</div>';
}
echo '</div>';
include('down.php');
include('meny.php');
echo '<br/>';navig($page, '?act=cat_view&id='.$id.'&', $pages);
}else{
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo 'В этом разделе пока нет сообщений<br/>Щёлкните <b>Новая тема</b>, и ваше сообщение станет первым!<br/>';
}
echo '<center><a href="posting.php?act=topic_add&id='.$id.'"><img width="110" height="26" src="/theme/diz/images/newthread.gif"/></a></center>';
echo '</div></div></div></div></div></div></div></div></div>';
}
}else{
echo'Такого раздела не существует!';
}
break;
}
include('down.php');
include('meny.php');
?>