-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
69 lines (57 loc) · 1.29 KB
/
login.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
<?php
$serverRoot = ".";
require_once("./php/session.php");
require_once('./php/login.php');
require_once('./php/ui.php');
initSession();
function hasLoginData() {
if(!isset($_POST['name']) || !isset($_POST['pw']))
return false;
return true;
}
function hasLogoutData() {
return isset($_POST['logout']);
}
?>
<!doctype html>
<html>
<head>
<title></title>
<?php uiMeta(); uiStyles() ?>
</head>
<body>
<?php uiHeader(true); uiNavi('account', true); uiSocial() ?>
<div id="cnt">
<?php
if(hasLoginData()) {
$name = $_POST['name'];
$pw = $_POST['pw'];
$res = tryLogin($name, $pw);
if($res->success) {
}
else {
echo "<h1>Fehler!</h1>";
}
}
else if(hasLogoutData()) {
tryLogout();
echo "<h1>Erfolgreich abgemeldet.</h1>";
}
else if(!isLoggedIn()) {
echo "<h1>Anmelden</h1>";
}
if(!isLoggedIn()) {
?>
<form action="login.php" method="POST">
<input type="text" placeholder="Name" name="name" />
<input type="password" placeholder="Passwort" name="pw" />
<input type="submit" value="Anmelden" />
</form>
<?php
}
else {
echo "<h1>Herzlich willkommen, " . getLoginName() . "!</h1>";
echo "<a href='fragenportal/kandidat.php?id=" . getLoginId() . "'>Zum Profil</a>";
echo "<p><form action='login.php' method='POST'><input type='submit' name='logout' value='Abmelden' /></p></form>";
}
?>