forked from Mino1289/BeerAdvisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
51 lines (44 loc) · 1.57 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
<link rel="stylesheet" href="./css/header.scss">
<header>
<div class="menu-container" onclick="changeState(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
<div id="topnav" class="topnav hide">
<a href="./index.php">Home</a>
<a href="./add_beer.php">Add a beer</a>
<?php
if(!(isset($_SESSION['ID_user']))){
echo' <a href="./login.php">Sign in</a>';
echo' <a href="./register.php">Sign up</a>';
} else if($_SESSION['ID_user'] == 1) {
// admin logged in
echo '<a href="./panel.php">Panel</a>';
}
?>
</div>
<?php
if(isset($_SESSION['ID_user']))
{
if(isset($_SESSION['profile_picture'])){
$img = base64_encode($_SESSION['profile_picture']);
echo '<a href="user.php?id='.$_SESSION['ID_user'].'">';
echo '<img id="pdp" alt="profile_picture" src="data:image/png;base64,'.$img.'" />';
echo '</a>';
}else{
echo '<a href="user.php?id='.$_SESSION['ID_user'].'"><img id="pdp" alt="profile_picture" src="img/No_account.png"/></a>';
}
}
else
{
echo '<a href="register.php"><img id="pdp" alt="profile_picture" src="img/2754.png"/></a>';
}
?>
<script>
function changeState(x) {
x.classList.toggle("change");
document.getElementById("topnav").classList.toggle("hide");
}
</script>
</header>