-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteaccount.php
81 lines (73 loc) · 2.29 KB
/
deleteaccount.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="bootstrap.css">
<title>Library Database</title>
</head>
<?php
//include DatabaseHelper.php file
require_once('databasehelper.php');
//instantiate DatabaseHelper class
$database = new DatabaseHelper();
//Grab variables from POST request
$email = '';
if(isset($_POST['email']))
$email = trim($_POST['email']);
?>
<body>
<div class='container-fluid'>
<!-- NAVBAR -->
<header>
<div class='row justify-content-center align-items-center'>
<div class='col-md-6 col-sm-0'>
</div>
<div class='col-md-2 col-sm-3'>
<a href='index.php'>
Browse
</a>
</div>
<div class='col-md-2 col-sm-4'>
<a href='mybookslogin.php'>
MyBooks
</a>
</div>
<div class='col-md-2 col-sm-3'>
<a href='register.php'>
Register
</a>
</div>
</div>
</header>
<main>
<!-- PAGE TITLE -->
<div class = 'row justify-content-center title'>
<div class='col-12'>
<h1>[ Library Database ]</h1>
</div>
</div>
<div class = 'row justify-content-center line'>
<div class='col-8'>
<hr>
</div>
</div>
<p style="text-align:center;max-width:50%;margin-left:auto;margin-right:auto;">
<!-- USER NOTIFICATION -->
<?php
if (count($database->MyBooks($email)) == 0) {
$database->DeleteAccount($email);
if (count($database->ExistingUser($email)) == 0)
echo 'Successfully deleted account!';
else
echo 'Account deletion unsuccessful. Contact the DBA.<br><br>';
echo 'Return to the <a href="index.php">homepage</a>.';
}
else
echo 'You\'ve still got borrowed books, go back and return them first before terminating your account.<br>';
?>
</p>
</main>
<footer><br><br><br><br></footer>
</body>
</html>