-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathheader.php
60 lines (60 loc) · 2.17 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
<?php
function drawHead($src) {
if($src == "main") { //Which page is it called from?
$backlink = "<a href='highscore.php'>Highscore</a> - <a href='standings.php'>Standings</a>";
} elseif($src == "score") {
$backlink = "<a href='index.php'>Homepage</a> - <a href='standings.php'>Standings</a>";
} elseif($src == "standings") {
$backlink = "<a href='index.php'>Homepage</a> - <a href='highscore.php'>Highscore</a>";
}
echo "<div id='headerhalf'>";
if(isset($_SESSION['login']) && $_SESSION['login']) { //user is logged in
echo '<form name="logout" action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo "<span class='welcome'>Hello ".$_SESSION['name']." - ".$backlink." - </span>";
echo '<input type="submit" class="logout" name="logout" value="Logout" />
</form>';
echo "<br>";
} else { //login
echo '<form name="login" action="'.$_SERVER['PHP_SELF'].'" method="post">
<div class="login-border-bottom"><input class="logininput" placeholder="Username" name="user" type="text" /></div>
<div class="login-border-bottom"><input class="logininput" placeholder="Password" name="pw" type="password" /></div>
<input type="submit" class="logout login" value="Login" />
</form>
<br>';
}
echo "</div>";
echo "<div id='headerhalf' style='text-align:right'>";
if(isset($_SESSION['login']) && $_SESSION['login']) {
echo "<div class='option'>";
echo "<span class='spoilerTxt'>Theme: </span>";
echo "<div id='spoiler' onclick='spoilerToggle(".$_SESSION['uid'].",1)'>";
echo " <div id='themeChoose' class='spoilerChoose'";
if($_SESSION['theme'] == 1) {
echo "style='float:right'>";
echo "Off";
} else {
echo "style='float:left'>";
echo "On";
}
echo "</div></div>";
echo "</div>";
echo "<div class='option'>";
echo "<span class='spoilerTxt'>Spoiler: </span>";
echo "<div id='spoiler' onclick='spoilerToggle(".$_SESSION['uid'].",0)'>";
echo "<div id='spoilerChoose' class='spoilerChoose'";
if($_SESSION['spoiler'] == 1) {
echo "style='float:right'>";
echo "Off";
} else {
echo "style='float:left'>";
echo "On";
}
echo "</div></div>";
echo "</div>";
} else {
echo "<span> </span>";
}
echo "<br>";
echo "</div>";
}
?>