-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount.php
More file actions
52 lines (49 loc) · 2.07 KB
/
Copy pathaccount.php
File metadata and controls
52 lines (49 loc) · 2.07 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
43
44
45
46
47
48
49
50
<?php
require_once "include/setupPDO.php";
require_once "include/includeClasses.php";
session_start();
if (!isset($_SESSION['email'])) {
header("Location:login.php");
} else {
$email = $_SESSION['email'];
$account = Account::get_account_from_mail($email);
if ($account == null) {
header("Location:login.php");
}
?>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Travia</title>
<link href="index.css?v=<?php echo time(); ?>" rel="stylesheet">
</head>
<body>
<?php include("include/header.inc.php");
if (isset($_GET["delete"])) {
if ($_GET["delete"] == 1) { ?>
<h1 style="text-align: center">Are you sure you want to delete your account ?<br>This action is irreversible.</h1>
<div class="account-actions">
<a href="?delete=2" class="account-link"><div class="account-button">Yes<br>I'm sure</div></a>
<a href="account.php" class="account-link"><div class="account-button">No<br>Go back</div></a>
</div>
<?php } else if ($_GET["delete"] == 2) {
if ($account->delete()) {
header("Location:login.php");
} else { ?>
<h1 style="text-align: center">Something went wrong, we couldn't delete your account, please try again later.</h1>
<?php }}} else { ?>
<h1 style="text-align: center">Hello <?= $account->get_first_name() . " " . $account->get_last_name() ?></h1>
<?php if ($account->is_admin()) { ?>
<h1 style="text-align: center">Admin account.</h1>
<?php } ?>
<div class="account-actions">
<a href="login.php" class="account-link"><div class="account-button">Log<br>Out</div></a>
<a href="?delete=1" class="account-link"><div class="account-button">Delete<br>Account</div></a>
</div>
<?php } ?>
</body>
<?php }
include("include/footer.inc.php");
require_once("include/background.php");
?>
</html>