-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathdelete_customer.php
More file actions
34 lines (28 loc) · 788 Bytes
/
delete_customer.php
File metadata and controls
34 lines (28 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once 'includes/auth_validate.php';
require_once './config/config.php';
$del_id = filter_input(INPUT_POST, 'del_id');
if ($del_id && $_SERVER['REQUEST_METHOD'] == 'POST')
{
if($_SESSION['admin_type']!='super'){
$_SESSION['failure'] = "You don't have permission to perform this action";
header('location: customers.php');
exit;
}
$customer_id = $del_id;
$db = getDbInstance();
$db->where('id', $customer_id);
$status = $db->delete('customers');
if ($status)
{
$_SESSION['info'] = "Customer deleted successfully!";
header('location: customers.php');
exit;
}
else
{
$_SESSION['failure'] = "Unable to delete customer";
header('location: customers.php');
exit;
}
}