blob: 92cddc195d8cf434148da728d59db70edeef8152 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
require_once('../src/base.inc.php');
$error = "";
if (isset($_GET['logout'])) {
unset($_SESSION['currentUser']);
}
if (isset($_POST['login_email']) and isset($_POST['login_password'])) {
$user = User::getByEmail(addslashes($_POST['login_email']));
if ($user and $user->authenticate($_POST['login_password'])) {
$_SESSION['currentUser'] = $user;
header('Location: index.php');
} else {
$error = "<div class=\"error\">Invalid Username/Password</div>";
}
}
require_once('header.inc.php');
?>
<h2>Login</h2>
<?php echo $error; ?>
<form method="post">
<label>Email</label>
<div class="element">
<input type="text" name="login_email" />
</div>
<label>Password</label>
<div class="element">
<input type="password" name="login_password" />
</div>
<div>
<input type="submit" value="Login" />
</div>
</form>
<?php
require_once('footer.inc.php');
?>
|