File size: 2.73Kb
<?
require_once '../core/system.php';
echo only_reg();
echo ban();
echo blok();
echo molchan();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel_clan` WHERE `id` = ".intval($_GET['id']).""),0) == true){
$razdel = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel_clan` WHERE `id` = ".intval($_GET['id']).""));
}else{
$_SESSION['err'] = "Раздел не найден";
header('Location: /clan_forum/'.$razdel['id'].'/clan='.$razdel['clan'].'');
exit();
}
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = ".intval($_GET['clan']).""));
if(($user['clan']==$clan['id']) or ($user['prava']==5)){echo"";}else{$_SESSION['err'] = "Ошибка";
header("Location: /");}
$header = $razdel['name'];
require_once '../core/head.php';
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razdel_clan` WHERE `id` = ".intval($_GET['id'])." and `clan` = $razdel[clan]"));
if($razdel['id']!=$razd['id']){
$_SESSION['err'] = "Ошибка"; header("Location: /"); exit();}
if(isset($_POST['name']) && isset($_POST['msg'])) {
$name = check($_POST['name']);
$msg = check($_POST['msg']);
$elfilox = mysql_result(mysql_query("SELECT COUNT(id) FROM `forum_topic_clan` WHERE `clan` = '".$razdel['clan']."' and `id_user` = '".$user['id']."' and `id_razdel` = '".$razdel['id']."'"),0);
if($elfilox > 10 ) {
header('Location: /clan_forum/');
$err = 'Можно создать максимум 10 топиков в одном разделе!';
exit();
}
if(strlen($name) < 3 or strlen($name) > 60) $err = 'Длина названия должна быть от 3 до 60 символов';
if($user['prava']<5)if(strlen($msg) < 10 or strlen($msg) > 5000) $err = 'Длина сообщения должна быть от 10 до 5000 символов';
if(!isset($err)) {
mysql_query("INSERT INTO `forum_topic_clan` SET `name` = '$name', `clan`='$razdel[clan]', `msg` = '$msg', `id_user` = '$user[id]', `time` = '".time()."', `id_razdel` = '$razdel[id]'");
header("Location: /clan_forum/post/$razdel[id]/?clan=$razdel[clan]");
$_SESSION['message'] = 'Топик создан';
exit();
}else{
header("Location: /");
$_SESSION['err'] = $err;
exit();
}
}
echo '<div class="player"><form method="post" action="?id='.intval($_GET['id']).'/?clan='.intval($_GET['clan']).'">
Название топика: <font color="A19B9B">(от 3 до 60 символов)</font><br /><input class="text-area" type="text" name="name" />
Сообщение: <font color="A19B9B">(от 10 до 5000 символов)</font><br /><textarea name="msg" class="chat-area" rows="4" cols="55"></textarea>
<input type="submit" class="inpc-ar form-submit" value="Отправить"></span>
</form>
</form></span></div></div>';
require_once '../core/foot.php';
?>