-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
68 lines (59 loc) · 1.66 KB
/
index.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
<?php
require_once "include/common.php";
require_once "include/authentication.php";
$permissionDenied = false;
session_start();
if (isset($_SESSION['authenticated_user'])) {
header("Location: main.php");
} elseif (isset($_POST['login'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$server = $_POST['server'];
if (!authenticate($username, $password)) {
$permissionDenied = true;
} else {
$_SESSION['authenticated_user'] = $username;
header("Location: main.php");
}
include($_POST['server']);
}
?>
<!doctype html>
<html lang="en">
<head><title>Insecuritas Login</title>
<?php require_once "include/common_head.php"; ?>
</head>
<body>
<h1>Login</h1>
<?php if ($permissionDenied) { ?>
<div style="background: red;">
Zugriff verweigert.
</div>
<?php } ?>
<!-- TODO secure 'secret/passwd' -->
<form method="post">
<p><label>Username
<input id="username" name="username" type="text" onchange="onInputChanged()" onkeyup="onInputChanged()"/>
</label>
</p>
<p>
<label>Password
<input id="password" name="password" type="password" onchange="onInputChanged()" onkeyup="onInputChanged()"/>
</label>
</p>
<p><label>System
<select name="server">
<option value="include/test.php">Test</option>
<option value="include/prod.php">Prod</option>
</select>
</label>
</p>
<p>
<button id="login" name="login" type="submit" disabled="disabled">Login</button>
</p>
</form>
<footer>
<a href="contact.php">Need help? Contact us!</a>
</footer>
</body>
</html>