File size: 664B
<?php
include"../../sys/fnc.php";
$msg=filtr($_POST['msg']);
$name=filtr($_POST['name']);
$data=date("d.m.Y H:i");
if(!empty($msg) and !empty($name) or !empty($msg) and !empty($log))
{
$res = $db->query("select * from `book` order by `id` desc limit 1");
$pole = $res->fetch_array();
if($pole[msg] != $msg)
{
if(!empty($log))
{
$db->query("insert into `book`(`name`,`data`,`msg`) values('$log','$data','$msg')");
}
else
{
$db->query("insert into `book`(`name`,`data`,`msg`) values('Гость $name','$data','$msg')");
}
echo'<font color="red">Сообщение добавлено!</font>';
}
$res->close();
}
?>