Файл: ask/handler/new_ask.php
Строк: 34
<?php
if (!empty($_POST['ask']) && $arr_ask['access'] != 3)
{
// Антифлуд
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ask_msg` WHERE `user_id` = '".$user_id."' AND `time` > '".(time()-5)."'"),0) == true) $flood = true;
$anonim = abs(intval($_POST['anonim']));
if ($anonim == 1 && $arr_ask['access'] != 2) $anonim = 1; else $anonim = 0;
$text = check($_POST['ask']);
$text = substr($text, 0, 1000);
if($flood == false && !empty($text)){
mysql_query("INSERT INTO `ask_msg` SET
`ask_id` = '".$id."',
`user_id` = '".$user_id."',
`anonim` = '".$anonim."',
`text` = '".$text."',
`time` = '".time()."',
`new` = 1
");
mysql_query("INSERT INTO `notifications` SET
`from_id` = '".$user_id."',
`sex` = '".$user['sex']."',
`for_id` = '".$id."',
`mod` = 'ask',
`type` = 'ask',
`refid` = '".$id."',
`time` = '".time()."',
`count` = 1,
`new` = 1
");
mysql_query("UPDATE `users` SET `notifications` = 1, notifications_journal=notifications_journal+1 WHERE `id` = '".$id."'");
mysql_query("UPDATE `ask` SET count_new=count_new+1 WHERE `user_id` = '".$id."'");
echo ok(lang('Вопрос отправлен','Запитання надіслано'));
}
}
?>