View file comm/board_add.php

File size: 2.02Kb
<?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();


$id = intval($_GET['id']);
$g = mysql_fetch_array(mysql_query("SELECT * FROM `community_comm` 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:]+&amp;._=/~%#]*(\\?[[:alnum:]?+&amp;_=/%#]*)?)?)", ' [реклама] ', $msg);

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: comm_guest.php?id=$id".SID);
exit;
}

echo '<form method="post" class="post" action="board_add.php?id='.$id.'">',
'Сообщение:<br />',
'<textarea name="msg"></textarea><br />';
if ($set['translit']==1) echo '<input type="checkbox" name="translit" value="1"> Транслит<br />';
echo '<input value="Отправить" type="submit"></form>';

echo '<a href="group_board.php?id='.$id.'"> Назад</a><br />';
echo '<a href="index.php?id='.$id.'"> Сообщество</a>';

include_once '../sys/inc/tfoot.php';
?>