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

File size: 2.12Kb
<?
require_once '../../../core/system.php';
echo only_reg();
$header = 'Удаление топика';
require_once '../../../core/head.php';
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: /');
exit();
}
echo "<div class='player menuList'>";
echo "</div><div class='foot center'><table  class='d-grey' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody>
<tr>";
echo '<div class="inpc-ar"><div class="empty2"></div>Вы действительно хотите удалить топик?<div class="empty2"></div>
<td width="40%"><a class="big-but" href="/clan_forum/post/topic/close.php?id='.$topic['id'].'&clan='.intval($_GET['clan']).'&yes"><div class="imgwrap"><img src="/images/icon/ok.png"></div>Удалить</a></td>';
echo '<td width="40%"><a class="big-but" href="/clan_forum/post/'.$topic['id_razdel'].'/?clan='.intval($_GET['clan']).'/"><div class="imgwrap"><img src="/images/icon/error.png"></div>Отмена</a></td></tbody></table></div></div>';
echo "</div>";

if(isset($_GET['yes'])){
$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`  = $user[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[id_razdel]/?clan=".intval($_GET['clan'])."");
mysql_query("DELETE FROM `forum_topic_clan` WHERE `id` = '$topic[id]'");
$_SESSION['message'] = "Топик удален";
exit();}else{$_SESSION['err'] = "Ошибка"; header("Location: /clan_forum/post/$topic[id_razdel]/?clan=".intval($_GET['clan']).""); exit();}
exit();
}

require_once '../../../core/foot.php';
?>