-
Notifications
You must be signed in to change notification settings - Fork 13
/
delete_customer.php
81 lines (70 loc) · 2.29 KB
/
delete_customer.php
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/* Avoid multiple sessions warning
Check if session is set before starting a new one. */
if(!isset($_SESSION)) {
session_start();
}
include "validate_admin.php";
include "connect.php";
include "header.php";
include "user_navbar.php";
include "admin_sidebar.php";
include "session_timeout.php";
if (isset($_GET['cust_id'])) {
$_SESSION['cust_id'] = $_GET['cust_id'];
}
$sql0 = "DELETE FROM customer WHERE cust_id=".$_SESSION['cust_id'];
$sql1 = "DROP TABLE passbook".$_SESSION['cust_id'];
$sql2 = "DROP TABLE beneficiary".$_SESSION['cust_id'];
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="action_style.css">
</head>
<body>
<div class="flex-container">
<div class="flex-item">
<?php
if (($conn->query($sql0) === TRUE)) { ?>
<p id="info"><?php echo "Customer Deleted Successfully !"; ?></p>
<?php
}
else { ?>
<p id="info"><?php echo "Error: " . $sql0 . "<br>" . $conn->error . "<br>"; ?></p>
<?php
}
?>
</div>
<div class="flex-item">
<?php
if (($conn->query($sql1) === TRUE)) { ?>
<p id="info"><?php echo "Customer's Passbook Deleted Successfully !"; ?></p>
<?php
}
else { ?>
<p id="info"><?php echo "Error: " . $sql1 . "<br>" . $conn->error . "<br>"; ?></p>
<?php
}
?>
</div>
<div class="flex-item">
<?php
if (($conn->query($sql2) === TRUE)) { ?>
<p id="info"><?php echo "Customer's Beneficiary Deleted Successfully !"; ?></p>
<?php
}
else { ?>
<p id="info"><?php echo "Error: " . $sql2 . "<br>" . $conn->error . "<br>"; ?></p>
<?php
}
?>
</div>
<?php $conn->close(); ?>
<div class="flex-item">
<a href="manage_customers.php" class="button">Go Back</a>
</div>
</div>
</body>
</html>