Размер файла: 3.11Kb
<?php
##################################
# theme.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 = abs(intval($_GET['page']));
}
else
{
$page = '1';
}
$p_str = $on_page*$page-$on_page;
if(isset($_GET['id']))
{
$id = intval($_GET['id']);
if(is_numeric($id))
{
if(!empty($id))
{
if(preg_match('/[0-9]/i',$id))
{
$themes = mysql_query("SELECT id_forum,name,status FROM `themes` WHERE `id` = '$id'");
if(mysql_num_rows($themes)!=0)
{
$t = mysql_query("SELECT * FROM `posts` WHERE `id_theme` = '$id' ORDER BY `time` ASC LIMIT $p_str,$on_page");
$postof = mysql_num_rows(mysql_query("SELECT * FROM `posts` WHERE `id_theme` = '$id' "));
echo '</div>
';
if($postof>0)
{
$number = $p_str;
$forum = mysql_fetch_array(mysql_query('SELECT id,name FROM `forums` WHERE `id`='.mysql_result($themes,0).''));
$theme = mysql_result(mysql_query('SELECT name FROM `themes` WHERE `id`='.$id.''),0);
$theme = mysql_result(mysql_query('SELECT name FROM `themes` WHERE `id`='.$id.''),0);
echo '<div class="main">
<a href="forum.php?id='.$forum['id'].'"><b>'.$forum['name'].'</b></a> => '.$theme.'
</div>
';
while($post = mysql_fetch_array($t))
{
$number++;
$author = mysql_fetch_array(mysql_query("SELECT login,posts FROM `users` WHERE `id` = '$post[author_id]' "));
echo '<div class="main">
'.$number.')<b>'.$author['login'].'</b>['.$author['posts'].'] <a onclick="document.getElementById(\'text\').value=\''.$author['login'].', \'">Отв.</a><br />
'.$post['time'].'<br />
'.smiles($post['text']).'</div>
' ;
}
echo '<div class="fon">
';
if($status == 'logined')
{
if($theme['status']!='0')
{
echo '
<form action="reply.php?mode=post&id_theme='.$id.'" method="POST">
Сообщение : <br />
<textarea name="text" rows="4" cols="25" id="text"></textarea><br />
<input type="submit" class="btn" value="Отправить" />
</form>
• <a href="smiles.php">Смайлы</a><br />
';
}
}
$str = ceil($postof/$on_page);
if($page>1)echo '<<<<a href="theme.php?id='.$id.'&page='.($page-1).'">Назад</a><br />';
if($page<$str)echo '<a href="theme.php?id='.$id.'&page='.($page+1).'">Вперед</a>>>><br />';
echo '</div><br />
';
}else{echo '<b>Сообщений пока нет!</b>';}
}else{echo 'Тема которую вы запросили <b>не существует</b>!';}
}
}else{echo 'ID темы пуст!';}
}
}else{echo 'Введите ID темы!';}
require_once 'includes/foot.php';
##################################
# © Все права защищены #
##################################
?>