<?
require_once("../conn.php");
require_once("access.php");

if(isset($_GET[id]))
{
	
	//get the images
	$q1 = "select logo, ResumeImages from yellow_posts where PostID = '$_GET[id]' ";
	$r1 = mysql_query($q1) or die(mysql_error());
	$a1 = mysql_fetch_array($r1);

	//delete the logo file
	if(!empty($a1[logo]))
	{
		unlink("../yellow_images/$a1[logo]");
	}

	//delete the resume images
	if(!empty($a1[ResumeImages]))
	{
		$images = explode("|", $a1[ResumeImages]);

		while(list(,$v) = each($images))
		{
			unlink("../yellow_images/$v");
		}
	}

	
	$q1 = "delete from yellow_posts where PostID = '$_GET[id]' ";
	mysql_query($q1) or die(mysql_error());

	header("location:manageads.php");
	exit();
}