Вход Регистрация
Файл: news/otvet.php
Строк: 74
<?
include_once '../sys/inc/start.php';
include_once 
'../sys/inc/compress.php';
include_once 
'../sys/inc/sess.php';
include_once 
'../sys/inc/home.php';
include_once 
'../sys/inc/settings.php';
include_once 
'../sys/inc/db_connect.php';
include_once 
'../sys/inc/ipua.php';
include_once 
'../sys/inc/fnc.php';
include_once 
'../sys/inc/user.php';
$set['title']='Новости - Ответ';
include_once 
'../sys/inc/thead.php';
title();
err();
only_reg();

$id=intval($_GET['id']);
$post=mysql_fetch_array(mysql_query("SELECT * FROM `news_komm` WHERE `id`='$id'"));
$ank=get_user($post['id_user']);

if(isset(
$_GET['go'])){
$msg=stripcslashes(htmlspecialchars(trim(esc($_POST['msg']))));
if (
strlen2($msg)>1024){$err='Сообщение слишком длинное';}
elseif (
strlen2($msg)<2){$err='Короткое сообщение';}
elseif (
mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '".$post['id_news']."' AND `id_user` = '$user[id]' AND `msg` = '".my_esc($msg)."' LIMIT 1"),0)!=0){$err='Ваше сообщение повторяет предыдущее';}
elseif(!isset(
$err)){
if (isset(
$user) && $user['id']!=$post['id_user']){
$msg2="[b]$user[nick][/b] Ответил на ваше сообщения, в  [url=/news/komm.php?id=$post[id_news]]новости[/url]";
mysql_query("INSERT INTO `jurnal` (`id_kont`, `msg`, `time`) values('$ank[id]', '$msg2', '$time')");
}
mysql_query("INSERT INTO `news_komm` (`id_user`, `time`, `msg`, `id_news`) values('$user[id]', '$time', '".my_esc($msg)."', '$post[id_news]')")or die("Invalid query: " mysql_error());
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+2)."' WHERE `id` = '$user[id]' LIMIT 1")or die("Invalid query: " mysql_error());
mysql_query("UPDATE `user` SET `akt_rating` = '".($user['akt_rating']+0.001)."' WHERE `id` = '$user[id]' LIMIT 1");
header("Location: /news/komm.php?id=$post[id_news]");
}
}

echo 
"<form method='post' name='message' action='?go&amp;id=$id'>n";
echo 
"Сообщение: <br />n<textarea name='msg'>$ank[nick], </textarea><br />n";
echo 
"<input value='Отправить' type='submit' />n";
echo 
"</form>n";

include_once 
'../sys/inc/tfoot.php';
?>
Онлайн: 3
Реклама