Файл: modules/askworld/handler/re_ask.php
Строк: 24
<?php
if (!empty($_POST['re_text']) && !empty($_GET['id']) && is_numeric($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ask_msg` WHERE `id` = '".abs(intval($_GET['id']))."' AND `ask_id` = '".$user_id."' AND `new` = 1 LIMIT 1"),0) == true)
{
$id = abs(intval($_GET['id']));
$arr_ask = mysql_fetch_array(mysql_query("SELECT * FROM `ask_msg` WHERE `id` = '".$id."' LIMIT 1"));
if ($user_id == $arr_ask['user_id']) {go(URL);}
$re_text = check($_POST['re_text']);
$re_text = substr($re_text, 0, 1000);
if (empty($re_text)) {go(URL.'/ask/ask.php');}
if (mysql_query("UPDATE `ask_msg` SET
`re_text` = '".$re_text."',
`new` = 0,
`time` = '".time()."'
WHERE `id` = '".$id."'") == true)
{
mysql_query("UPDATE `ask` SET count_new=count_new-1 WHERE `user_id` = '".$user_id."'");
mysql_query("UPDATE `users` SET count_ask=count_ask+1 WHERE `id` = '".$user_id."'");
mysql_query("INSERT INTO `notifications` SET
`from_id` = '".$user_id."',
`sex` = '".$user['sex']."',
`for_id` = '".$arr_ask['user_id']."',
`mod` = 'ask',
`type` = 're_ask',
`refid` = '".$user_id."',
`time` = '".time()."',
`count` = 1,
`new` = 1
");
mysql_query("UPDATE `users` SET `notifications` = 1, notifications_journal=notifications_journal+1 WHERE `id` = '".$arr_ask['user_id']."'");
}
}
?>