-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
71 lines (65 loc) · 2.31 KB
/
index.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
<?php
require_once 'core/init.php';
$user = new User();
if ($user->isLoggedIn()) {
$username = escape($user->data()->username);
?>
<?php include 'resources.php'; ?>
<?php if (Session::exists('success')) : ?>
<div class="alert alert-success">
<?php echo Session::flash('success'); ?>
</div>
<?php endif; ?>
<?php if (Session::exists('error')) : ?>
<div class="alert alert-danger">
<?php echo Session::flash('error'); ?>
</div>
<?php endif; ?>
<section class="ftco-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 text-center mb-4">
<h2 class="heading-section">Welcome, <?php echo escape($user->data()->username); ?>!</h2>
</div>
</div>
<div class="row justify-content-center mb-4">
<nav class="navbar navbar-expand-lg bg-primary rounded-xlg px-2">
<ul class="navbar-nav mr-auto font-weight-semibold">
<li class="nav-item px-2">
<a class="nav-link" href="index.php?user=<?php echo escape($user->data()->username); ?>">Profile</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="index.php?update">Edit Profile</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="index.php?changepassword">Change Password</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</nav>
</div>
<div class="row justify-content-center">
<div class="col-md-6">
<?php
if (isset($_GET['user'])) {
require_once 'profile.php';
} elseif (isset($_GET['update'])) {
require_once 'update.php';
} elseif (isset($_GET['changepassword'])) {
require_once 'changepassword.php';
} else {
if (!isset($_GET['user']) || $_GET['user'] !== $username) {
Redirect::to("index.php?user=" . $username);
}
}
?>
</div>
</div>
</div>
</section>
<?php
} else {
redirect::to('login.php');
}