Размер файла: 2.49Kb
<?php
##################################
# forum.php #
##################################
# Форум на MySQL #
#Афтар : Morgan #
#ICQ : 530-648 #
#Email : [email protected] #
##################################
require_once 'includes/start.php';
require_once 'includes/functions.php';
require_once 'includes/db.php';
require_once 'includes/avt.php';
require_once 'includes/head.php';
if(isset($_GET['page']))
{$page = $_GET['page'];}
else{$page=1;}
$p_str = $page*$on_page-$on_page;
if(isset($_GET['id']))
{
$id = $_GET['id'];
if(!empty($id))
{
if(preg_match('/[0-9]/i',$id))
{
$forums = mysql_query("SELECT name FROM `forums` WHERE `id` LIKE '$id'");
if(mysql_num_rows($forums)!=0)
{
$temp = mysql_fetch_array($forums);
echo '</div><div class="main">
<b>'.$temp['name'].'</b>
</div><div class="fon">
';
$themes = mysql_query("SELECT * FROM `themes` WHERE `id_forum` LIKE '$id' ORDER BY `time` DESC LIMIT $p_str,$on_page");
if(mysql_num_rows($themes)!=0)
{
while($theme = mysql_fetch_array($themes))
{
$author = mysql_fetch_array(mysql_query("SELECT login FROM `users` WHERE `id` = '$theme[author_id]' "));
$posts = mysql_num_rows(mysql_query("SELECT id FROM `posts` WHERE `id_theme` = '$theme[id]'"));
echo '•';
if($theme['status']=='0') echo '#';
echo'<a href="theme.php?id='.$theme['id'].'">'.$theme['name'].'</a>
['.$posts.'] '.$author['login'];
if($user_inf['dol']=='admin')
{
echo ' | ';
if($theme['status']=='0') echo '<a href="admin.php?mode=open&id_theme='.$theme['id'].'">[open]</a>';
else {echo '<a href="admin.php?mode=close&id_theme='.$theme['id'].'">[close]</a> ';}
echo '<a href="admin.php?mode=del&id_theme='.$theme['id'].'">[del]</a>';
}
echo '<br />
';
}
}else{echo 'Здесь пока нет тем!';}
if($status == 'logined') { echo '<hr/>
• <a href="reply.php?mode=theme&id_forum='.$id.'">Создать новую тему</a><br />'; }
}else{echo 'Раздел который вы запросили <b>не существует</b>!';}
}
}else{echo 'ID подфорума пуст!';}
}else {echo 'Введите ID подфорума!';}
echo '</div><br />
';
require_once 'includes/foot.php';
##################################
# © Все права защищены #
##################################
?>