-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
93 lines (89 loc) · 2.23 KB
/
admin.php
File metadata and controls
93 lines (89 loc) · 2.23 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
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
89
90
91
92
93
<?php
//if(!$_SERVER['HTTPS'])
// header(sprintf('Location: https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]));
require('config.php');
require('classes/user.php');
require('classes/shift.php');
include('functions.php');
session_start();
$alerts=array();
$notifs=array();
if(!isset($_SESSION['user'])) $_SESSION['user'] =false;
if(isset($_POST['action']) && $_POST['action'] == 'login'){
$user = new User($_POST['name']);
$user->passhash=sha1($_POST['password']);
if($user->login())
$_SESSION['user']=$user;
else
$alerts[]="Nutzername und/oder Passwort falsch.";
}
if($_SESSION['user'])
$_SESSION['user']->select();
if(isset($_POST['action'])){
if($_POST['action'] == 'logout') logout();
if($_POST['action'] == 'new_shift') new_shift();
if($_POST['action'] == 'delete_shift') delete_shift();
if($_POST['action'] == 'add_user') add_user();
if($_POST['action'] == 'lost_passwd') lost_passwd();
if($_POST['action'] == 'change_password') change_password();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<!-- Atom feed
<link rel="alternate"
type="application/atom+xml"
title="My Weblog feed"
href="/feed/" />
-->
</head>
<body>
<header>
<nav>
<?php
if(isset($_SESSION['user']) && $_SESSION['user'])
print "<span id=\"loggedin\">Eingeloggt als ".$_SESSION['user']->name.".</span>";
?>
<ul>
<li><a class="navlink" href="./">home</a></li>
<li><a class="navlink" href="./admin.php">admin</a></li>
</ul>
<div style="clear:both;" />
</nav>
<hgroup>
<h1>Sofa-Cafe</h1>
<h2>Admininterface</h2>
<?php
foreach($alerts as $alert) printf('<h3 class="alert">%s</h3>', $alert);
foreach($notifs as $notif) printf('<h3 class="notif">%s</h3>', $notif);
?>
</hgroup>
</header>
<div class="content">
<div class="left">
<?php
if(isset($_SESSION['user']) && $_SESSION['user'])
include('panel.inc.php');
else {
if(isset($_GET['action']) && $_GET['action'] == 'lost_passwd')
include('lost_passwd.inc.php');
else
include('login.inc.php');
}
?>
</div>
<div class="right">
<?php
write_table();
$sql=null;
?>
</div>
</div>
<footer>
<p>fuer die sache.</p>
</footer>
</body>
</html>