-
Notifications
You must be signed in to change notification settings - Fork 1
/
bar.php
77 lines (61 loc) · 2.2 KB
/
bar.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
<?php
require_once('config.php');
$sError = "";
if (isset($_SESSION['error']) && strlen($_SESSION['error']) > 0) {
$sError = '<span id="error">' . $_SESSION['error'] . '</span><br />';
$_SESSION['error'] = '';
}
loggedIn();
include('quotedb.php');
mysqli_close($con);
$links = [];
$links[] = array(
'link' => '/index.php',
'title' => 'Home'
);
$links[] = array(
'link' => '/commit.php',
'title' => 'Commit',
'logged' => true,
);
$links[] = array(
'link' => '/appointment.php',
'title' => 'Meet',
'logged' => true,
);
$links[] = array(
'link' => '/profile.php',
'title' => 'Profile',
'logged' => true,
);
$header_bar = '<div id="header-bar">
<div id="header-user">
';
if(isset($_SESSION['loggedin']) && $_SESSION['loggedin']) {
$header_bar .= ' <span class="header-text"><a href="profile.php" id="header-username">'.$_SESSION['username'].'</a> (<a id="header-logout" href="redirect.php?action=logout">Logout</a>)</span>
';
}
else {
$header_bar .= ' <div id="header-login"><form name="login" method="post" action="redirect.php?action=login"><span class="header-text">Username:</span> <input id="header-username" type="text" name="username" /> <span class="header-text">Password:</span> <input id="header-password" type="password" name="password" /> <input type="submit" name="submit" value="Login" /> <input type="submit" name="submit" value="Register" /> <a href="/reset.php">Reset</a></form><div class="header-error">'.$sError.'</div></div>
';
}
$header_bar .= ' </div>
<div id="header-links">
';
foreach($links as $l) {
$hidden = isset($l['logged']) && !isset($_SESSION['loggedin'])?' hidden':'';
if($_SERVER['PHP_SELF'] == $l['link']) {
$header_bar .= ' <span class="header-link green'.$hidden.'">'.$l['title'].'</span>
';
}
else {
$header_bar .= ' <span class="header-link'.$hidden.'"><a href="'.$l['link'].'">'.$l['title'].'</a></span>
';
}
}
$header_bar .= ' <span class="header-image"><a title="Get our Android app on Google Play" href="https://play.google.com/store/apps/details?id=org.sirimangalo.meditationplus" target="_blank"><img src="https://ssl.gstatic.com/android/market_images/web/play_logo.png" height="16px"></a></span>
';
$header_bar .= ' </div>
';
$header_bar .= '
</div>';