Файл: group/board_add.php
Строк: 74
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
only_reg();
if ($_SESSION['g_board']+30 > $time){header("Location: index.php?antispam&".SID);exit;}
if (!isset($_GET['id']) || mysql_result(mysql_query("SELECT COUNT(id) FROM `group` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"),0)==0){header('Location: index.php?');exit;}
$id = intval($_GET['id']);
$g = mysql_fetch_array(mysql_query("SELECT * FROM `group` WHERE `id` = '$id' LIMIT 1"));
$set['title'] = 'Чат сообщества '.$g['name'];
include_once '../sys/inc/thead.php';
title();
aut();
if (isset($_POST['msg']))
{
$msg = mysql_real_escape_string($_POST['msg']);
$msg = eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/~%#]*(\?[[:alnum:]?+&_=/%#]*)?)?)", ' [реклама] ', $msg);
if ($_SESSION['g_board'] > $time-30){header("Location: index.php?antispam&".SID);exit;}
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg) > 512){header("Location: board_add.php?id=$id&err=msg_max&".SID);exit;}
if (strlen2($msg) < 2){header("Location: board_add.php?id=$id&err=msg_min&".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `group_board` WHERE `user` = '$user[id]' AND `msg` = '$msg' AND `time` > '".($time-300)."' LIMIT 1"),0) > 0){header("Location: board_add.php?id=$id&err=msg_exists&".SID);exit;}
mysql_query("INSERT INTO `group_board` (g, user, time, msg) values('$id', '$user[id]', '$time', '$msg')");
$_SESSION['g_board'] = $time;
header("Location: group_board.php?id=$id&ok&".SID);
exit;
}
echo '<div class="p_t">Чат сообщества '.$g['name'].'</div>';
echo '<div class="p_m">Написать сообщение</div>';
echo '<form method="post" class="post" action="board_add.php?id='.$id.'">',
'Сообщение:<br />',
'<textarea rows="5" cols="50" name="msg"></textarea><br />';
if ($set['translit']==1) echo '<input type="checkbox" name="translit" value="1"> Транслит<br />';
echo '<input value="Отправить" type="submit"></form>';
echo '<br /> <a href="group_board.php?id='.$id.'"> Назад</a>';
echo '<br /> <a href="index.php?id='.$id.'"> Сообщество</a>';
include_once '../sys/inc/tfoot.php';
?>