<?
$page = "delete_weblog.php";
include "manager_header.php";
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
if(isset($_POST['w_id'])) { $w_id = $_POST['w_id']; } elseif(isset($_GET['w_id'])) { $w_id = $_GET['w_id']; } else { header("Location: index.php"); exit(); }
$weblog = mysql_query("SELECT * FROM bhost_weblogs WHERE w_id='$w_id' AND u_id='$user_info[u_id]'");
if(mysql_num_rows($weblog) != 1) { header("Location: index.php"); exit(); }
$weblog_info = mysql_fetch_assoc($weblog);


if($task == "cancel") {
header("Location: index.php");
exit();
}



if($task == "deletedo") {
mysql_query("DELETE FROM bhost_comments WHERE w_id='$weblog_info[w_id]'");
mysql_query("DELETE FROM bhost_entries WHERE w_id='$weblog_info[w_id]'");
mysql_query("DELETE FROM bhost_entrycategories WHERE w_id='$weblog_info[w_id]'");
mysql_query("DELETE FROM bhost_trackbacks WHERE w_id='$weblog_info[w_id]'");
mysql_query("DELETE FROM bhost_weblogs WHERE w_id='$weblog_info[w_id]'");
header("Location: index.php");
exit();
}








if($task == "main") {
echo $head;
echo "
$delete_weblog1

<br><br>

<table cellpadding='0' cellspacing='0'>
<form action='delete_weblog.php' method='POST'>
<tr>
<td>
<input type='submit' class='button' value='$delete_weblog2'>&nbsp;
<input type='hidden' name='task' value='deletedo'>
<input type='hidden' name='w_id' value='$w_id'>
</td>
</form>
<form action='delete_weblog.php' method='POST'>
<td>
<input type='submit' class='button' value='$delete_weblog3'>
<input type='hidden' name='task' value='cancel'>
<input type='hidden' name='w_id' value='$w_id'>
</td>
</tr>
</form>
</table>
";
echo $foot;
exit();
}


?>