<?php require_once('header.php'); 
$pod_type=$_GET['pod_type'];
?>

<?php
if(!isset($_REQUEST['id'])) {
	header('location: logout.php');
	exit;
} else {
	// Check the id is valid or not
	$statement = $pdo->prepare("SELECT * FROM tbl_pod WHERE id=? AND pod_type=?");
	$statement->execute(array($_REQUEST['id'],$pod_type));
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
	foreach($result as $row)
	{ $img1=$row['url_1'];
	     $img2=$row['url_2'];
	      $img3=$row['url_3'];
	       $img4=$row['url_4'];
	        $img5=$row['url_5'];
	    
	}
	
	
	$total = $statement->rowCount();
	if( $total == 0 ) {
		header('location: logout.php');
		exit;
	}
}
?>

<?php
    // Unlink the photo
if($img1!='') {
	unlink('img/POD/'.$img1);
}  
if($img2!='') {unlink('img/POD/'.$img2);}
if($img3!='') {unlink('img/POD/'.$img3);}
if($img4!='') {unlink('img/POD/'.$img4);}
if($img5!='') {unlink('img/POD/'.$img5);}
    

	
	
	
	// Delete from Pincode
	$statement = $pdo->prepare("DELETE FROM tbl_pod WHERE id=? AND pod_type=? ");
	$statement->execute(array($_REQUEST['id'],$pod_type));

	header('location: list_pod.php');
?>