-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
58 lines (42 loc) · 1.65 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
<?php
include __DIR__ . '/lib/autoload.php';
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
$email = $_POST['email'];
$password = $_POST['password'];
$imap = new Imap($email, $password);
if ($imap->auth()) {
$_SESSION['account'] = $email;
$_SESSION['status'] = 'logged_in';
header('Location: /account');
setcookie('account', $email);
}
echo $email;
?>
<?php include __DIR__ . '/_head.php'; ?>
<form class="form-signin" method="post" action="./index.php">
<div class="text-center mb-4">
<img class="mb-4 ml-5" src="https://cct-ev.de/wp-content/themes/cct_5/images/logo_black.png" alt="">
<p>Melde dich mit deinen CCT e.V. Zugangsdaten an.</p>
<?php
if (!empty($email)) {
echo ($imap->auth()) ? '<div class="alert alert-success">Login erfolgreich</div>' : '<div class="alert alert-danger">Kein Login möglich. Korrekte Daten?</div>';
}
?>
</div>
<div class="form-label-group">
<input type="email" id="inputEmail" name="email" class="form-control" placeholder="Email address" required
autofocus value="<?= $_POST['email'] ?>">
<label for="inputEmail">Email address</label>
</div>
<div class="form-label-group">
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password"
required>
<label for="inputPassword">Password</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
<?php
include __DIR__ . '/_tail.php';
?>