-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
68 lines (62 loc) · 2.9 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
<?php
if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}
?>
<nav class="navbar navbar-expand-lg ">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" href="home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="shop">Shop</a>
</li>
<?php if(!isset($_SESSION['user_id'])) { ?>
<li class="nav-item">
<a class="nav-link" href="login">Login</a>
</li>
<?php } ?>
</ul>
<?php if(isset($_SESSION['user_id'])) { ?>
<div class="d-flex align-items-center">
<?php
$select_cart_count = mysqli_query($conn, "SELECT * FROM `cart` WHERE user_id = '$user_id'") or die('query failed');
$cart_num_rows = mysqli_num_rows($select_cart_count);
?>
<a href="cart" class="btn btn-sm btn-outline-light me-2"><i class="fas fa-shopping-cart"></i><span>(<?php echo $cart_num_rows; ?>)</span></a>
<div class="dropdown">
<button class="btn btn-sm btn-outline-light dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
<?php echo $_SESSION['user_name']; ?>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuButton">
<li><a class="dropdown-item" href="#"><?php echo $_SESSION['user_email']; ?></a></li>
<li><hr class="dropdown-divider"></li>
<li>
<a class="dropdown-item" href="orders">Orders</a>
</li>
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
</ul>
</div>
</div>
<?php } ?>
</div>
</div>
</nav>