<?PHP





			session_start();


$privilage = $_SESSION['privilage']; 

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
	header ("Location: ../login.php");
}
		



?>


<?php
require 'config.php';

			$db_handle = mysqli_connect(DB_SERVER, DB_USER, DB_PASS);
			$database = $_SESSION['database'];

 			//$database = "lawpedc3_lbs_users";
			$db_found = mysqli_select_db($db_handle, $database);
			



if($privilage =="admin")
{
	
	
	 $txnid= $_GET['txnId'];
	
	
	 if($db_found){
	 
 

	 
	$SQL = "DELETE FROM debtors_table WHERE product_id=$txnid";
   $query_del = mysqli_query($db_handle, $SQL);
		  
		//   header ("Location:debtors.php");

	  	$notification = "Operation Successfull";
	
header ("Location: debtors.php?txnfailed=$notification");
	
	  
	  
  }
	

	
}




else{
	
		
		$notification = "You are not Authorized";
	
header ("Location: debtors.php?txnfailed=$notification");
}

	  

?>






	<html>
		
			<title>Delete_script</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->	
		 <link href="css/bootstrap-4.4.1.css" rel="stylesheet">
		
		
		
	<head>



	</head>
	<body>


		

			
	<div class="jumbotron" style="text-align: center">
		
		
		<h3><b><span style="color: #EC0408">Are you sure you want to DELETE this transaction?</b></h3>
		</span> <br> Transaction ID<?php echo $txnid;?>
		
		
		
			<table style="margin: auto;width: 100%" >
					<form action="record_delete.php" method="post">
		
	<tr>
				<td>
				
		 				<input type="submit" value="NO" class="btn btn-danger" style= "width:100%; height: 70px" name = "NO" >
					
				</td>
					
				<td>
					
		 			<a href="delet.php">	<input type="button"  value="YES" class="btn btn-danger" style= "width:100%; height: 70px"  > </a>
				</td>
	
	</tr>
	</form>
			
			</table>
	
		
			</div>
			
	

	</body>
	</html>
