-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
52 lines (47 loc) · 1.46 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
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>BookHub</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<h2>BookHub</h2>
</div>
<div class="content">
<!-- notification message -->
<?php if (isset($_SESSION['success'])) : ?>
<div class="error success" >
<h3>
<?php
echo $_SESSION['success'];
unset($_SESSION['success']);
?>
</h3>
</div>
<?php endif ?>
<!-- logged in user information -->
<?php if (isset($_SESSION['username'])) : ?>
<p>Welcome <strong><?php echo $_SESSION['username'];
?></strong></p>
<p> <a href="BookAdded.php?<?php echo htmlspecialchars(SID); ?>" style="color: blue;">Sell a Book</a> </p>
<p> <a href="account.php?<?php echo htmlspecialchars(SID); ?>" style="color: blue;">Account</a> </p>
<p> <a href="Buy.php?<?php echo htmlspecialchars(SID); ?>" style="color: blue;">Buy A Book</a> </p>
<p> <a href="TestFiles/loadTest.php?<?php echo htmlspecialchars(SID); ?>" style="color: blue;">Loadtest</a> </p>
<p> <a href="index.php?logout=1" style="color: red;">logout</a> </p>
<?php endif ?>
</div>
</body>
</html>