-
Notifications
You must be signed in to change notification settings - Fork 1
/
header.php
70 lines (65 loc) · 3.25 KB
/
header.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
<!-- By Marasingha MAMN IT23539990 -->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./CSS/partials.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"/> <!--For dropdown menu-->
<script src="./js/partials.js"></script>
</head>
<body>
<header>
<div class="main_header">
<a href="index.php"><img src="images/Pharmacy X.png" alt="PharmacyX Logo"></a>
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="products.php">Products</a></li>
<li><a href="aboutUs.php">About</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</nav>
<?php
if(!isset($_SESSION['username']))
{
// signin button for users who are not signed in
echo "<button onclick='window.location.href=\"signin.php\"'>Sign in</button>";
}
else
{
//check if user is admin manager or customer and display DB links accordingly
if($_SESSION['user_type']== 'Admin')
{
$DBLink = "<a href='./admin_DB.php'>Admin DB</a>";
}
else if($_SESSION['user_type']== 'Manager')
{
$DBLink = "<a href='./manager_DB.php'>Manager DB</a>";
}
else if($_SESSION['user_type']== 'Customer')
{
$DBLink = "<a href='./my_orders.php'>My Orders</a>";
}
// assign profile picture name to a variable
$baseProfilePicUrl = './Images/Profile_Pics/'; // base derecotry of profile pictures
$profilePicUrl = isset($_SESSION['profilePic_url']) ? htmlspecialchars($baseProfilePicUrl.$_SESSION['profilePic_url']) : './Images/Profile_Pics/student-avatar-illustratio.jpg'; // Default profile picture
// user profile for users who are signed in
echo "<div class='user_profile' onclick='dropdownmenu()'>
<img src='".$profilePicUrl."' alt='User Profile'>
<h3 class='username no-select'>Hello ".$_SESSION['firstname']." <i class='fas fa-caret-down'></i></h3>
<div class='Profile_dropdown' id='prof_dropdown'>
<div class='dropdown_items'>
<a href='my_account.php'>My Profile</a>
".$DBLink."
<a onclick='return confirm(\"Do you want to sign out now?\")' href='logout.php'>Sign Out</a>
</div>
</div>
</div>";
}
?>
</div>
</header>
</body>
</html>