View file modules/news/delete.php

File size: 1.82Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author:  Nikoloz Sitchinava [sitchi]      //
// Link:        http://sitchicms.num.ge          //
// Skype:       SitchiCMS                        //
// License:     LICENSE.txt (see attached file)  //
// Version:     VERSION.txt (see attached file)  //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../../'; 
require $root_path.'includes/db_connect.php'; //   
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `news` WHERE `id` = '".intval($_GET['id'])."'"),0)==1)
{
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `news` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
if ($user['level']>=5)
{
mysql_query("DELETE FROM `news` WHERE `id` = '$post[id]'");
mysql_query("DELETE FROM `news_komm` WHERE `id_news` = '$post[id]'");
mysql_query("OPTIMIZE TABLE `news`");
}
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL)
header("Location: ".$_SERVER['HTTP_REFERER']);
else
header("Location: index.php?".SID);
}
if (isset($_GET['id2']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id` = '".intval($_GET['id2'])."'"),0)==1)
{
$post=mysql_fetch_assoc(mysql_query("SELECT * FROM `news_komm` WHERE `id` = '".intval($_GET['id2'])."' LIMIT 1"));
if ($user['level']>=2)
{
mysql_query("DELETE FROM `news_komm` WHERE `id` = '$post[id]'");
}
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!=NULL)
header("Location: ".$_SERVER['HTTP_REFERER']);
else
header("Location: komm.php?id=$post[id_news]".SID);
}
?>