-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
66 lines (53 loc) · 1.95 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
<?php
// session_start();
if (!isset($_SESSION)) {
session_start();
}
?>
<header class="navbar">
<div class="webName">
<a class="title" href="home.php">Smart Thing</a>
</div>
<button class="toggle-menu">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</button>
<div class="links">
<ul>
<li><a href="allProducts.php">All items</a>
<div class="sub-menu">
<ul>
<li><a href="allProducts.php?cat=0">Voice assistants</a></li>
<li><a href="allProducts.php?cat=1">Smart switches</a></li>
<li><a href="allProducts.php?cat=2">Smart lights</a></li>
<li><a href="allProducts.php?cat=3">Smart sensors</a></li>
<li><a href="allProducts.php?cat=4">Smart plugs</a></li>
<li><a href="allProducts.php?cat=5">Smart controllers</a></li>
</ul>
</div>
</li>
<li><a href="aboutUs.php">about us</a></li>
<?php
if(!isset($_SESSION['user'])){
echo " <li><a href='login.php'>login</a></li>
<li><a href='register.php'>register</a></li>";
}
else {
if($_SESSION['user']['admin'] == true){
echo "<li><a href='homeadmin.php'>Adminstration</a></li>";
}
echo " <li><a href='viewCart.php'>cart</a></li>
<li><a href='singout.php'>sign out</a></li>";
}
?>
</ul>
</div>
</header>
<script>
const toggleButton = document.getElementsByClassName('toggle-menu')[0]
const linkss = document.getElementsByClassName('links')[0]
toggleButton.addEventListener('click', ()=>{
linkss.classList.toggle('active')
})
</script>