-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_account.php
More file actions
42 lines (34 loc) · 1.19 KB
/
Copy pathdelete_account.php
File metadata and controls
42 lines (34 loc) · 1.19 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delete Account</title>
</head>
<body>
<h4 class="text-center mt-4 mb-4">Delete Account?</h4>
<form action="" method="post" >
<div class="col-12 mb-3 text-center">
<input type="submit" value="Delete" name="delete" class="btn btn-red" >
</div>
<div class="col-12 mb-5 text-center">
<input type="submit" value="Cancel" name="dont_delete" class="btn btn-info" >
</div>
</form>
<?php
$username_session=$_SESSION['username'];
if(isset($_POST['delete'])){
$delete_query="Delete from `user_table` where username='$username_session'";
$result=mysqli_query($conn,$delete_query);
if($result){
session_destroy();
echo"<script>alert('Account Deleted Successfully')</script>";
echo"<script>window.open('index.php','_self')</script>";
}
}
if(isset($_POST['dont_delete'])){
echo"<script>window.open('profile.php','_self')</script>";
}
?>
</body>
</html>