Файл: muzxit.ru/qchat/new.php
Строк: 42
<?php
defined('_IN_JOHNCMS') or die('Error: restricted access');
$flood = functions::antiflood();
if ($flood) {
echo functions::display_error($lng['error_flood'] . ' ' . $flood . $lng['sec'] . '<br /><a href="?act=new' . isset($_GET['id']) ? '&id=' . $_GET['id'] : '' . '">' . $lng['back'] . '</a>');
require('../incfiles/end.php');
exit;
}else{
echo '<div class="phdr">Добавление нового сообщения</div>';
if (isset($_POST['submit'])){
if ((mb_strlen($_POST['msg']) < 500) && (mb_strlen($_POST['msg']) > 2)){
if (mysql_query("INSERT INTO `qchat` SET
`avtor` = '" . $user_id . "',
`msg` = '" . trim(mysql_real_escape_string($_POST['msg'])) . "',
`time` = '" . time() . "'")){
header('location:index.php');
}else{
echo functions::display_error('Не удалось добавить сообщение');
require_once ('../incfiles/end.php');
exit;
}
}else{
echo functions::display_error('Сообщение превышает допустимое кол-во символов');
require_once ('../incfiles/end.php');
exit;
}
}else{
if (isset($_GET['id'])){
$mass = mysql_fetch_array(mysql_query("SELECT * FROM `qchat` WHERE `id` = '" . intval($_GET['id']) . "'"));
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='" . $mass['avtor'] . "'")); }
$avtor = isset($_GET['id']) ? '&id=' . intval($_GET['id']) : '';
$avtor1 = isset($_GET['id']) ? $us['name'] . ',' : '';
echo '<div class="gmenu"><form name="form" action="index.php?act=new' . $avtor . '" method="post">';
if (!$is_mobile) echo bbcode::auto_bb('form', 'msg');
echo '<textarea rows="' . $set_user['field_h'] . '" name="msg">' . $avtor1 . ' </textarea><br /><input type="submit" name="submit" value="Написать" /></form></div>'; }
echo '<div class="phdr"><a href ="?">В чат</a></div>';
require_once ('../incfiles/end.php'); }