-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.php
50 lines (48 loc) · 1.45 KB
/
footer.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
<footer class="navbar navbar-fixed-bottom" style="border-top-width:medium;border-color:#4A0086;">
<div class="navbar-inner">
<div class="container" style="margin-top:5px;margin-bottom:5px;">
<?php if(isset($_SESSION['name'])){echo "<div class=\"col-xs-8\">Sie sind gerade eingeloggt als ".$_SESSION['name']."(".getStatus()."). Ihre Session läuft noch <span id=\"timer\">".getTime()."</span> <span id=\"min\">Minuten</span>!</div><div class=\"col-xs-4\" style=\"text-align:right;\">Version ".getVersion()."</div>";} ?>
</div>
</div>
</footer>
<?php
function getStatus(){
if($_SESSION['status']==1){
return "Bediener";
}elseif($_SESSION['status']==2){
return "Verantwortlicher";
}
elseif($_SESSION['status']==3){
return "Superuser";
}
getVersion();
}
function getTime(){
return (time() - $_SESSION['LAST_ACTIVITY']+1800/60);
}
function getVersion(){
$handle = fopen("changelog.txt", "r");
if ($handle) {
$line = fgets($handle);
fclose($handle);
return $line;
} else {
return "nicht lesbar. Fehler beim Öffnen der Datei.";
}
}
?>
<script>
setInterval(function() {
var mins = $("#timer").html();
mins = parseInt(mins);
if(mins>0){
mins--;
if(mins==1){
$("#min").html("Minute");
}else{
$("#min").html("Minuten");
}
}
$("#timer").html(mins);
}, 60 * 1000);
</script>