View file modules/forum/delete_forum.php

File size: 1.54Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_forum';
if($user['level'] == 2 || $user['level'] >= 6) {
if(isset($_GET['f_id'])) {
if(isset($_POST['yes'])) {
$db->query("DELETE FROM `forum` WHERE `id` = '". abs(intval($_GET['f_id'])) ."'");
$db->query("DELETE FROM `forum_c` WHERE `f_id` = '". abs(intval($_GET['f_id'])) ."'");
$cid = $db->query("SELECT id FROM `forum_c` WHERE `f_id` = '". abs(intval($_GET['f_id'])) ."'")->fetchColumn();
$db->query("DELETE FROM `forum_t` WHERE `cat_id` = '". $cid ."'");
$tid = $db->query("SELECT topic_id FROM `forum_pt` WHERE `cat_id` = '". $cid ."'")->fetchColumn();
$db->query("DELETE FROM `forum_pt` WHERE `topic_id` = '". $tid ."'");
go('/forum/');
	} elseif(isset($_POST['no'])) {
go('/forum/');
	} 
$title = $lang->word('delete');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('delete'));
echo '<form action="/forum/delete_forum/'.abs(intval($_GET['f_id'])).'/" method="post">
		<div class="menu">
			<b>'. $lang->word('r_sure') .'</b><br/>
			<input name="yes" type="submit" value="'. $lang->word('yyes') .'" /> <input name="no" type="submit" value="'. $lang->word('yno') .'" /><br/>
		</div>
		</form>';
		
$tpl->div('block', NAV .'<a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/'); } 
} else { go('/'); }
?>