<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';

if (empty($user_id)) {go(URL.'/');}

if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
	$id = abs(intval($_GET['id']));

	if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `blog_comm` WHERE `id` = '".$id."' LIMIT 1"),0) == true)
	{
		$arr_comm = mysql_fetch_array(mysql_query("SELECT * FROM `blog_comm` WHERE `id` = '".$id."' LIMIT 1"));
		$arr_blog = mysql_fetch_array(mysql_query("SELECT * FROM `blog` WHERE `id` = '".$arr_comm['fid']."' LIMIT 1"));
		
		if ($user_id == $arr_comm['user_id'] or $user_id == $arr_blog['user_id'])
		{
		mysql_query("DELETE FROM `blog_comm` WHERE `id` = '".$id."'");
		mysql_query("UPDATE `blog` SET comm=comm-1 WHERE `id` = '".$arr_blog['id']."'");
			go(URL.'/response/post.php?id='.$arr_blog['id'].'');
		}
		go(URL.'/response/post.php?id='.$arr_blog['id'].'');
	}
		go(URL.'/response/post.php?id='.$arr_blog['id'].'');
}

	go(URL.'/response/post.php?id='.$arr_blog['id'].'');

?>