Просмотр файла download/comment.php

Размер файла: 3.34Kb
<?
/*
=============================================
Движок: SHCMS Engine
=============================================
Название файла: Обменник - Комментарии
=============================================
Official website: http://shcms.ru
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
if($_GET['id'])
{$id = $_GET['id'];}
$file2 = mysql_fetch_array(mysql_query("SELECT * FROM download_file WHERE id=$id"));
$shcmsengine['title'] = 'Комментарии к файлу '.$file2['names'].'';

$user_s = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$user_id"));

include_once'../template/head.php';


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

if(isset($user_id))
{
if($brodilka == "web")
{
$text_list->text_lister();
}
echo '<form action?id='.$id.'&'.$conservation.'" method="post" name="form">';
echo 'Текст комментария:<br/><textarea name="text"></textarea>';
echo '<input type="submit" name="submit" value="Добавить">';
echo '</form>';
}
$komm1 = mysql_query("SELECT * FROM down_comment WHERE id_file = $id ORDER BY id DESC");
$komm = mysql_fetch_array($komm1);
if($komm == null)
{
echo '<div class="posts">Комментрии отсутствуют</div>';
}
else
{
do
{
echo '<div class="posts"><a href="'.DIR_SHCMS.'change_view.php?id='.$komm['user_id'].'">'.$komm['author'].'</a> ('.date('d.m.y',$komm['time']).' в '. date('H:i:s',$komm['time']).') <br/>'.handling_smileys($komm['text']).'';
echo '<span style="float:right;">';
if($user4['team'] == 6)
{
echo '<a href="comment.php?id_del='.$komm['id'].'&delete&id='.$id.'">Удалить</a></span></div>';
}}
while($komm = mysql_fetch_array($komm1));
}

if($_POST['submit'])
{$submit = $_POST['submit'];}


if(isset($submit))
{
if($_POST['text'])
{$text = $_POST['text'];}


if(empty($text))
{
echo '<div class="errors">Вы не ввели текст сообщения</div>';
header("Refresh: 1; url=?id=$id");
include_once'../template/foot.php';
exit();
}

$text_ok = mysql_query("INSERT INTO down_comment (id_file,user_id,author,text,time) VALUES ('$id','$user_id','$user_s[login]','$text','$time_date')");
if($text_ok == true)
{
echo '<div class="actshcms">Ваш комментарий успешно добавлен</div>';
header("Refresh: 1; url=?id=$id");
include_once'../template/foot.php';
exit();
}
else
{
echo '<div class="errors">Ваш комментарий не добавлен</div>';
header("Refresh: 1; url=?id=$id");
include_once'../template/foot.php';
exit();

}
}
if(isset($_GET['delete']))
{
if($user4['team'] == 6)
{
if($_GET['id_del'])
{$id_del = $_GET['id_del'];}

$del_ok = mysql_query("DELETE FROM down_comment WHERE id=$id_del");
if($del_ok == true)
{
echo '<div class="actshcms">Комментарий успешно удален</div>';
header("Refresh: 1; url=?id=$id");
include_once'../template/foot.php';
exit();
}
else
{
echo '<div class="errors">Комментарий не удален</div>';
header("Refresh: 1; url=?id=$id");
include_once'../template/foot.php';
exit();
}}
}




include_once'../template/foot.php';
?>