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

Размер файла: 4.59Kb
<?
/*
=============================================
Движок:  SHCMS Engine
=============================================
Название файла: Форум
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
if($_GET['id']){$id = $_GET['id'];}
$tits = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id=$id"));
$shcmsengine['title'] = 'Тема '.$tits['name'].'';
include_once'../template/head.php';
$user4 = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$user_id"));
  $allfield = mysql_result(mysql_query("SELECT COUNT(*) FROM forum_mess WHERE id_them=$id"),0);
  $newlist = new Navigation($allfield, // кол-во полей для вывода
                            10,         // выводить 10 записей на страницу
                           true);     // выводить "Стр." возле ссылок навигации

$msy = mysql_query("SELECT * FROM forum_mess WHERE id_them=$id ORDER BY `id` DESC  ". $newlist->limit()."");
$mysql_mess = mysql_fetch_array($msy);
$id_text = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id_them=$id"));

$id_cat = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id_them=$id"  ));

$yels = mysql_fetch_array(mysql_query("SELECT * FROM forum_them WHERE id=$id"));

if(!$id)
{
echo'<div class="errors">Вы зашли неправильно</div>';
header('Refresh: 1; url=/forum');
	include_once'../template/foot.php';
exit();
}






if($user_id)
{
if($brodilka == "web")
{$text_list->text_lister();}

echo '<form action="?id='.$id.'" method="post" name="form">';
echo 'Текст: <textarea name="text"></textarea>';
echo '<input type="submit" name="submit">';
}
if($_POST['submit'])
{
$submit = $_POST['submit'];
}
if(isset($submit))
{
if($_POST['text'])
{
$message = $_POST['text'];
}
if(empty($message))
{
echo'<div class="errors">Введите описание</div>';
header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
	include_once'../template/foot.php';
exit();
}
$message = stripslashes($message);
$message = htmlspecialchars($message);
if(strlen($message)< 0 ||  strlen($message) >3000)
{
echo'<div class="errors">Описание должен быть не больше 3000 символов</div>';
exit();
}
if(isset($message))
{
$messag = mysql_query("INSERT INTO forum_mess (id_cat,id_razd,id_them,message,time,id_user) VALUES ('$yels[id_cat]','$yels[id_razd]','$id','$message','$time_date','$user_id')");
$balls = $user4['ball'] +1;
mysql_query("UPDATE users SET ball=".$balls." WHERE id=".$user_id."");
if($messag == true)
{
echo '<div class="actshcms">Сообщение добавлено</div>';
header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
	include_once'../template/foot.php';
exit();
}
else
{
echo '<div class="errors">Сообщение не добавлено</div>';
header('Refresh: 1; url=?id='.$id.'&' . $conservation . '&' );
	include_once'../template/foot.php';
exit();
}
}
}		

$ri_them = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE id=$id"));
$user_them = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE id=$ri_them[user_id]"));
echo '<div class="mysql_yes">';


//Анкета пользователя
users_profile($user_them['id']);
echo '('.$timedate->when($ri_them['time']).')<br/><hr/>';
echo handling_smileys($ri_them['text']).'</div><hr/>';
if($mysql_mess==null){echo '<div class="posts">В теме нет сообщений</div>';}
else
{
do
{

	 echo  '<div class="posts">';
	 //Анкета пользователя
users_profile($mysql_mess['id_user']);
	 
echo '('.$timedate->when($mysql_mess['time']).')';

echo '<br/>'.handling_smileys($mysql_mess['message']).'';
if($user_them['id'] == $user_id || $user4['team'] == 6)
{echo '<span style="float:right"><a href="/forum/delete.mess.php?id='.$id.'&id_del='.$mysql_mess['id'].'">Удалить</a></span>';}
echo '</div>';

}
while($mysql_mess = mysql_fetch_array($msy));
echo '<div class="pages">';
echo $newlist->pagination();
echo '</div>';
}

echo '<div class="posts"><a href="javascript:history.back()">Назад</a></div>';
if($users_nav['team'] == 6){echo '<div class="posts"><a href="/forum/edit.them.php?id='.$id.'">Параметры темы</a></div>';
echo '<div class="posts"><a href="/forum/delete.them.php?id='.$id.'">Удаление темы</a></div>';}
	include_once'../template/foot.php';
?>