blob: 0ea8ecdce06e910466edc8a100dd4e68efc965a0 (
plain)
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
|
<?php
define("LOGIN_SITE", true);
require_once __DIR__ . '/session.php';
require_once __DIR__ . '/../vendor/autoload.php';
$mail = strtolower($_REQUEST["email"]);
$hash = $_REQUEST["hash"];
$redis = new Predis\Client([
'scheme' => 'tcp',
'host' => '192.168.122.1',
'port' => 6379,
'database' => 2,
]);
$correct_hash = $redis->get($mail);
if ( $hash === $correct_hash ) {
$_SESSION["login"] = true;
$_SESSION["success"] = "Erfolgreich eingeloggt.";
$_SESSION["user"] = $mail;
$_SESSION["dontdisplaydeploybutton"] = 1;
header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect");
header("Location: /");
exit;
} else {
$_SESSION["login"] = false;
$_SESSION["error"] = "Entweder kennen wir deine E-Mail nicht oder du hast den Code falsch kopiert.";
header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect");
header("Location: /login.php");
}
|