-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
54 lines (51 loc) · 2.05 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
48
49
50
51
52
53
54
<?php require_once 'html_components/require_comps_start.php';
if(isset($_GET['logout'])){
$user->logout();
$session->setMessage("You are now logged out." , "info");
redirect('login.php');
}
//if the user is already logged in, no need to ask him again for the credentials, take him to the admin area:
if( $user->isLoggedIn() ){ redirect('index.php'); }
// else check to see if the form is submitted. If yes, authenticate...
if ( areSet( array( 'username','password' ), $_POST ) )
{
if( User::authenticate($_POST['username'],$_POST['password']) )
{
redirect('index.php');
}
else
{
$session->setMessage("Incorrect Username and / or Password.",'danger');
redirect("login.php");
}
}
// page starts here:
?>
<div class="modalBackdrop"></div>
<div class='row'>
<div class='col-sm-12 col-lg-4 col-lg-offset-4'>
<form id="loginForm" class="form-horizontal gridBkg" role="form" method="post">
<div class="input-group">
<label for="username" class="input-group-addon"><?=icon('user')?></label>
<input class="form-control" id="username" name="username" placeholder="Username" required>
</div>
<div class="input-group">
<label for="password" class="input-group-addon"><?=icon('lock')?></label>
<input type="password" class="form-control" id="password" name="password" placeholder="Password" required>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<div class="checkbox">
<label> <input type="checkbox" name="rememberMe"> Remember me </label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-primary form-control">Login</button>
</div>
</div>
</form>
</div>
</div>
<?php require_once 'html_components/require_comps_end.php'; ?>