Файл: Ajax_Chat_by_Valen_v1.1/add_mess.php
Строк: 13
<?php
include"db_con.php";
if(!$inf['id']) exit;
$us_id = trim(mysql_real_escape_string(htmlspecialchars($_SESSION['id'])));
$mess = trim(mysql_real_escape_string(htmlspecialchars($_POST['mess'])));
if($mess)
{
if(mysql_result(mysql_query("SELECT `content` FROM `mail` ORDER BY `id` DESC LIMIT 1"), 0) != $mess)
{
if((time() - $_SESSION['time_up']) > 5)
{
mysql_query("INSERT INTO `mail` SET
`user`='".(int)$us_id."',
`date`='".date('d.m.Y, H:i')."',
`time`='".time()."',
`content`='".$mess."'");
$_SESSION['time_up'] = time();
}
else
{
setcookie("errors", "<b>Не так быстро!</b>", time()+3, "/");
}
}
}
/* Тут удаление мессаг*/
if($_POST['del_mess'])
{
if($inf['level'] >= $level) mysql_query ("DELETE FROM `mail` WHERE `id` = '".(int)$_POST['del_mess']."' LIMIT 1");
}
?>