-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
43 lines (40 loc) · 1.05 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
<?php
session_start();
if (!isset($_SESSION['success'])) {
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['success']);
header("location: login.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="header">
<h2>Home Page</h2>
</div>
<div class="content">
<?php if (isset($_SESSION['success'])) : ?>
<!-- notification message -->
<div class="error success" >
<h3> <?php echo $_SESSION['success']; ?> </h3>
</div>
<!-- logged in user information -->
<p>Welcome <strong><?php echo $_SESSION['first_name'] . ' ' . $_SESSION['last_name']; ?></strong></p>
<?php
/* destroying session/global variables */
unset($_SESSION['success']);
unset($_SESSION['first_name']);
unset($_SESSION['last_name']);
?>
<p> <a href="index.php?logout='1'" style="color: red;">logout</a> </p>
<?php endif ?>
</div>
</body>
</html>