<?
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';

$us_adm=intval($_GET['id']);

if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `community_comm` WHERE `id` = '".intval($_GET['id'])."'"),0)==1)
{
$comm = mysql_fetch_array(mysql_query("SELECT * FROM `community_comm` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));

if (isset($user) && $user['id']==$comm['id_author'] || $user['level']>2)
{
mysql_query("DELETE FROM `community_comm` WHERE `id` = '$comm[id]'");
mysql_query("DELETE FROM `community_user_incomm` WHERE `cid` = '$comm[id]'");
mysql_query("DELETE FROM `community_forum_topics` WHERE `rid` = '$comm[id]'");
mysql_query("DELETE FROM `group_board` WHERE `g` = '$comm[id]'");
header("Location: index.php?comm=del".SID);
}
else
header("Location: comm.php?id=".intval($_GET['id'])."".SID);
}


?>