This repository has been archived by the owner on May 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdelAccount.php
59 lines (48 loc) · 1.44 KB
/
delAccount.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
<?php include("header.php");
include "loadClass.php";
if (!isset($_SESSION["loggedin"])) {
header('location: index.php');
}
?>
<?php
$queries = new queries;
if (isset($_POST['submit'])) {
$password = $_POST['password'];
echo $password;
if ($queries->query("SELECT * FROM user WHERE username = ? ", [$username])) {
if ($queries->count() > 0) {
$row = $queries->fetch();
$dbPassword = $row->password;
if (password_verify($password, $dbPassword)) {
$update = mysqli_query($con, "UPDATE user SET status = 2 WHERE username='$username'");
echo "<script>
alert('We are sorry to see you go');
document.location='logout.php';
</script>";
} else {
echo "<script>
alert('Incorrect Password');
document.location='logout.php';
</script>";
}
}
} else {
echo "<script>
alert('Suspicios activity');
document.location='logout.php';
</script>";
}
}
?>
<div class="d-flex align-items-center justify-content-center">
<div style="height:100vh; padding-top:10vh;">
<img class="logocircle" src="img/delete.png" title="logo" width="210px" height="200px" alt="trash" />
<form action="" name="passform" method="POST">
<div class="form-group mt-2">
<input type="password" class="form-control" name="password" placeholder="Password">
</div>
<button type="submit" name="submit" class="btn btn-danger">Delete Account</button>
</form>
</div>
</div>
<?php include("footer.php"); ?>