-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
47 lines (46 loc) · 1.02 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
<?php
require_once('db.inc.php');
require_once("User.php");
$bLoggedIn = false; //isset($_COOKIE["logged_in"]) and $_COOKIE["logged_in"] and false;
if(!$bLoggedIn and isset($_POST["submit"]))
{
if(isset($_POST["name"]) and isset($_POST["password"]))
{
$user = user_from_form($db, $_POST["name"], $_POST["password"]);
if(isset($user))
{
$bLoggedIn = true;
setcookie("logged_in", true);
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MalkNet</title>
</head>
<body>
<?php
if($bLoggedIn)
{
?>
<h1>Willkommen im MalkNet: <?=$user->name?> (Credits: <?=$user->money?>)</h1>
<?php
}
else
{
?>
<form method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="password">Passwort:</label>
<input type="password" id="password" name="password">
<input type="submit" name="submit" id="submit" value="Login">
</form>
<?php
}
?>
</body>
</html>