-
Notifications
You must be signed in to change notification settings - Fork 4
/
login.php
48 lines (39 loc) · 1.21 KB
/
login.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
session_start();
// Necessary files
require_once('interfaces/interface.authConfig.php');
require_once('classes/class.helper.php');
require_once('classes/class.auth.php');
// Instantiate class auth before loading authBackends from config.authenticationBackends.php
$auth = new auth;
// The following if-clause is needed for testing purposes. It's false in release packages.
if(file_exists($incFile = 'test/config.authenticationBackends.php'))
{
require_once($incFile);
}
else
{
require_once('config/config.authenticationBackends.php');
}
// Check if $uid and $pw are set
if(isset($_POST['uid']) && isset($_POST['pw']))
{
$uid = $_POST['uid'];
$pw = $_POST['pw'];
// If authentication was successful redirect user to profile download
if($auth->authUser($uid, $pw) !== false)
{
$_SESSION = $_POST;
header("Location: " . HELPER::setURL(HELPER::getCurrentProtocol(), 'index.php'));
}
else
{
echo 'Incorrect username / password';
}
}
?>
<form method="post" action="" name="login">
<input type="text" placeholder="Username" name="uid" required="true" /><br />
<input type="password" placeholder="Password" name="pw" required="true" /><br />
<input type="submit" />
</form>