Просмотр файла forum/theme.php

Размер файла: 4Kb
<?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/other.php';
 require_once 'includes/head.php';

if(isset($_GET['page']))
{
$page = obr($_GET['page'],'integer');
}
else
{
$page = '1';

}
$_SESSION['page_in_theme']=$page;

$p_str = $on_page*$page-$on_page;
if(isset($_GET['id']))
{
$id = obr($_GET['id'],'integer');
 if(is_numeric($id))
  {
  if(!empty($id))
  {



    if(is_numeric($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>
         ';
         $str = ceil($postof/$on_page);
        if($postof>0)
        {
        if($page<$str or $page==$str)
        {

        $forum = mysql_fetch_array(mysql_query('SELECT id,name FROM `forums` WHERE `id`='.mysql_result($themes,0).''));
        $theme = mysql_fetch_array(mysql_query('SELECT name,status FROM `themes` WHERE `id`='.$id.''));
echo '<div class="main">
<a href="forum.php?id='.$forum['id'].'"><b>'.$forum['name'].'</b></a> => '.$theme['name'].'
</div>
';
$number = $p_str;
  while($post = mysql_fetch_array($t))
{
$number++;
$author = mysql_fetch_array(mysql_query("SELECT login,id,avatar FROM `users` WHERE `id` = '$post[author_id]' "));
echo '<div class="main">
<img src="images/avatars/'.$author['avatar'].'"/>   <b>'.$number.'</b>)<a href="user.php?id='.$author['id'].'"><b>'.illuminate($author['id']).'</b></a>'.online($author['id']);
if($status == 'logined')echo ' <a onclick="document.getElementById(\'text\').value=\''.$author['login'].', \'">Отв</a>';
if($user_inf['dol']=='admin') echo '|<a href="admin.php?mode=del&id_post='.$post['id'].'">Del</a>';

echo '<br />'.$post['time'].'<br />
'.antimat(smiles(bb_code($post['text'])));
if($user_inf['dol']=='admin')
{  echo '<br /><font color="#C900C9"><small>('.$post['ip'].','.$post['ua'].')</small></font>';  }
echo '</div>
' ;
}
echo '<div class="fon">
';
if($page>3)echo '<<<<a href="theme.php?id='.$id.'&page=1">В начало.</a><br />';
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 />';
if(($str-$page)>2)echo '<a href="theme.php?id='.$id.'&page='.$str.'">В конец.</a>>>><br />';
echo 'Текущая страница <b>'.$page.'</b> из <b>'.$str.'</b>';
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>
&bull; <a href="smiles.php">Смайлы</a><br />
&bull; <a href="bb_code.php">BB коды</a><br />
';
}
else{echo '<b>Тема закрыта</b><br />';}
}
echo '</div><br />
';      }else{echo 'Такой страницы не существует!<br />
';}
        }else{echo '<b>Сообщений пока нет!</b>';}
        }else{echo 'Тема которую вы запросили <b>не существует</b>!';}

      }

  }else{echo 'ID темы пуст!';}
 }
}else{echo 'Введите ID темы!';}

 require_once 'includes/foot.php';
##################################
#      © Все права защищены      #
##################################
?>