Mini Shell

Direktori : /proc/thread-self/root/home/mhcadmin/.trash/IMS/
Upload File :
Current File : //proc/thread-self/root/home/mhcadmin/.trash/IMS/delete_complaint.php

<?php 
session_start();


require_once 'includes/auth_validate.php';
require_once './config/config.php';

$CustomerID = "";
require_once 'AccessControl.php';
if ($DeleteComplaint == 1) { 

$del_id = filter_input(INPUT_POST, 'del_id');
if ($del_id && $_SERVER['REQUEST_METHOD'] == 'POST') 
{

$results = mysqli_query( $connection,"SELECT * FROM complaints WHERE ComplaintID = $del_id");
$num1=mysqli_num_rows($results);

	if ($num1 >0){
		
		$row = mysqli_fetch_array($results);
        $CustomerID = $row['CustomerID'];
		
		}
	
    $complaint_id = $del_id;

    $db = getDbInstance();
    $db->where('ComplaintID', $complaint_id);
    $status = $db->delete('complaints');
	
	
$resultss = mysqli_query( $connection,"SELECT * FROM complaints WHERE CustomerID = $CustomerID");
    $nums=mysqli_num_rows($resultss);

	if ($nums < 1){
				
     $db = getDbInstance();
     $db->where('id', $CustomerID);
    $status = $db->delete('customers');
    
	}
			
	
	$db = getDbInstance();
    $db->where('ComplaintID', $complaint_id);
    $status = $db->delete('history');
	
    
		if ($status) 
    {
        $_SESSION['info'] = "Complaint record deleted successfully!";
        header('location: AdminTotalComplaints.php');
        exit;
    }
    else
    {
    	$_SESSION['failure'] = "Unable to delete record";
    	header('location: AdminTotalComplaints.php');
        exit;

    }
    
		
		
}

}else { header('location:AccessLevelMessage.php');}

include_once 'includes/footer.php'; ?>