<?php
session_start();

if ($_SESSION["denglu"] != 1)
{
	echo "<h3>you have not logged in</h3>";
	echo "If you are an administrator, <a href=../login.php>login here</a><br>";
	echo "If you are not administrator, <a href=../index.htm>visit our website</a>";
	exit;
}

$id = $_POST["id"];

$link = mysql_connect("localhost", "whateversg", "what0820");
mysql_select_db("whatever_com_sg", $link);

$query = "delete from media_category where categoryID='$id'";

mysql_query($query);

$query = "update media_media set CategoryID=0 where CategoryID='$id'";
mysql_query($query);

header("location: category.php");
?>