View file sdark.mobi/clan_forum/post/topic/topic_close.php

File size: 1.2Kb
<?
require_once '../../../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic_clan` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$topic = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id`  = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Топик не найден";
header("Location: /clan_forum/?clan=".intval($_GET['clan'])."");
exit();
}
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`  = '".intval($_GET['clan'])."'"));
$razd = mysql_fetch_array(mysql_query("SELECT * FROM `forum_topic_clan` WHERE `id`  = ".intval($_GET['id'])." and `clan`  = ".intval($_GET['clan']).""));
if(($user['id']==$topic['id_user'] or (($user['dolz']=='заместитель' or $user['dolz']='основатель') and $user['clan']==$topic['clan']) or $user['prava'] > 4)){

header("Location: /clan_forum/post/topic/$topic[id]/?clan=".intval($_GET['clan'])."");
mysql_query("UPDATE `forum_topic_clan` SET `close` = '1' WHERE `id` = '$topic[id]' LIMIT 1");
$_SESSION['message'] = "Топик закрыт";
exit();}else{$_SESSION['err'] = "Ошибка"; header("Location: /"); exit();}
?>