-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
141 lines (122 loc) · 5.77 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
//Tell PHP to log errors
ini_set('log_errors', 'On');
//Tell PHP to not display errors
ini_set('display_errors', 'Off');
//Set error_reporting to E_ALL
ini_set('error_reporting', E_ALL );
// Start the session
session_start();
?>
<!doctype html>
<html lang="en">
<body>
<nav class="navbar navbar-expand-lg" aria-label="Tenth navbar example" id="navbar"
style="background: black;box-shadow: 0px 4px 8px rgb(0, 0, 0,0.5);">
<div class="container-fluid">
<button class="navbar-toggler collapsed mb-3 text-white" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarsExample08" aria-controls="navbarsExample08" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<img src="assests/images/logo.png" alt="" class="image-fluid rounded-circle" style="width:12vh">
<div class="brand py-2"><a href="#" class="text-white">  BookStore</a></div>
<div class="navbar-collapse justify-content-md-center collapse" id="navbarsExample08">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.php#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.php#services">Services</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#gallery" id="navbarDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Gallery
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="index.php#topcategory">Top Categories</a></li>
<li><a class="dropdown-item" href="index.php#featured">Featured Products</a></li>
<li><a class="dropdown-item" href="index.php#new">New Arrivals</a></li>
<li>
<hr class="dropdown-divider">
</li>
<?php
include '_dbConnect.php';
$sql = "select * from search";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
foreach ($result as $row) {
echo'
<li><a class="dropdown-item text-dark" href="category.php?category='.ucwords($row["sname"]).'">'.ucwords($row["sname"]).'</a></li>'; } ?>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.php#reviews">Reviews</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="contact.php">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="page" href="Feedback_Form.php">Feedback</a>
</li>
</ul>
</div>
<div>
<div class="text-center" style="color:rgb(85,150,162)"><?php if($_SESSION["uname"]) { echo 'Hello, ' . $_SESSION["uname"] . ' !'; } ?></div>
<div class="icons text-white">
<?php $uid = $_SESSION['uid'];
echo '<a href="ViewWishlist.php?uid='.$uid.'"><i class="fas fa-heart px-2" id="wishlist-btn"></i></a>';
echo '<a class="nav-link" href="cart.php?uid='.$uid.'"><i class="fas fa-shopping-cart" id="cart-btn"></i> '; if($_SESSION['uname']){echo '<span id="cart-item" class="badge" style="background:var(--gold)"></span>';} echo'</a>';
?>
<?php
if(!$_SESSION["uname"])
echo '<a href="Login_reg.html"><i class="fas fa-sign-in-alt px-2" id="login-btn" onclick="myFunction()"></i></a>';
else
{
echo '<div class="btn-group dropstart">
<a class="dropdown-toggle text-white" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-user"></i>
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<li><a class="dropdown-item" href="logout.php">Log Out</a></li>
<li> <hr class="dropdown-divider"> </li>
<li><a class="dropdown-item" href="order.php?uid='.$uid.'">Order History</a></li>
<li><a class="dropdown-item" href="User_page.php">User Profile</a></li>
</ul>
</div>';
}
?>
</div>
</div>
</div>
</nav>
<form action="search.php" method="POST" class="search-bar-container" onclick="search()">
<input type="search" id="search-bar" name="search" placeholder="search by category...">
<label for="search-bar" class="fas fa-search"></label>
</form>
<script type="text/javascript">
function myFunction()
{
let loginForm = document.querySelector('.login-form-container');
loginForm.classList.add('active');
}
$(document).ready(function() {
// Load total no.of items added in the cart and display in the navbar
load_cart_item_number();
function load_cart_item_number() {
$.ajax({
url: 'action.php',
method: 'get',
data: {
cartItem: "cart_item"
},
success: function(response) {
$("#cart-item").html(response);
}
});
}
});
</script>
</body>
</html>