-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
49 lines (44 loc) · 1.29 KB
/
header.php
File metadata and controls
49 lines (44 loc) · 1.29 KB
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
<?php
session_start();
// Header part of the web app.
if($_SESSION['clogin']==true && $_SESSION['cuserid']){
if(isset($_COOKIE['clogin'])){
$_SESSION['cuserid'] = json_decode($_COOKIE['clogin'])[0]->id;
$_SESSION['clogin'] = true;
}
}
?>
<header id="bodyheader">
<div class="left">
<a href="./index.php"><?php echo $appname; ?></a>
</div>
<div class="right">
<?php
if($_SESSION['clogin']==true && $_SESSION['cuserid']){
// User Logged in Options.
?>
<?php
if(strpos($_SERVER['PHP_SELF'],'usercp.php')!=false)
{
echo "
<a href=\"profile.php?userid={$_SESSION['cuserid']}\" title='User Profile'><i class=\"fas fa-user\"></i></a>   ";
echo "<a href='changepass.php' title='Change Password'><i class=\"fas fa-user-lock\"></i></a>   ";
echo "<a href='changeusername.php' title='Change Username'><i class=\"fas fa-user-tag\"></i></a>";
}
else{
echo '<a href=\'usercp.php\' title=\'User CP\'><i class="fas fa-cog"></i></a>';
}
?>
  
<a title='Logout' href="logout.php"><i class="fas fa-door-open"></i></a>
<?php
}
else{
// User Logged Out.
?>
<a href="login.php">Login</a>  <a href="register.php">Register</a>
<?php
}
?>
</div>
</header>