-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.php
88 lines (68 loc) · 2.48 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
// redirecting to login page if not logged in
session_start();
if(!isset($_SESSION['username'])){
ob_start();
header('Location: '.'login.php');
ob_end_flush();
die();
}
echo "<pre>".$_SESSION['username']."</pre>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style media="screen">
nav a{
margin-right: 1em;
}
</style>
<header>
<title>Tompkins CS</title>
<!-- Display the countdown timer in an element -->
<p id="timer" style="display: inline"></p>
<!-- links for other pages -->
<nav id = 'tabs' style="float: right">
<a href=<?php echo $dir."index.php" ?>>Home</a>
<a href=<?php echo $dir."menu.php" ?>>Menu</a>
<a href = <?php echo $dir."vieworders.php" ?>>View Orders</a>
<?php if($_SESSION['perm']==100){ ?>
<a href=<?php echo $dir."writtenScore.php" ?>>Writtens</a>
<?php } ?>
<?php if($_SESSION['perm']==100){ ?>
<a href=<?php echo $dir."addTeam.php" ?>>Add Team</a>
<?php } ?>
<?php if($_SESSION['perm']==100){ ?>
<a href=<?php echo $dir."uploads/gradeProblems.php" ?>>Grade Problems</a>
<?php } ?>
<?php if($_SESSION['perm']==1){ ?>
<a href=<?php echo $dir."submitProblem.php" ?>>Submit Problems</a>
<?php } ?>
<a href=<?php echo $dir."downloads.php" ?>>Downloads</a>
<a href=<?php echo $dir."logout.php" ?>>Logout</a>
</nav>
</header>
<script type="text/javascript">
Notification.requestPermission();
// Set the date we're counting down to
var countDownDate = new Date("January 26, 2019 7:00:00").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the result in the element with id="demo"
document.getElementById("timer").innerHTML = hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is finished, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("timer").innerHTML = "EXPIRED";
$("#problemSubmit").prop('disabled', true)
}
}, 1000);
</script>