/
login.php
53 lines (47 loc) · 1.66 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
<?php
ob_start();
if(isset($_SESSION['isloginAdmin']) && $_SESSION['isloginAdmin'] == true)
header('Location: admin'); /*It can't be back to the login page once you are log-in and redirect you to admin page */
$msg = '';
$username = '';
$password = '';
if(isset($_POST['login']))
{
$username = trim($_POST['username']);
$password = trim($_POST['password']);
if(login_admin($username,$password))
{
if($_SESSION['isloginAdmin'] == true)
header("location: admin");
}
else
{
$msg = '<code>Invalid login!</code>';
header('Refresh: 1');
}
}
?>
<header id="top" class="header">
<div class="text-vertical-center">
<form class="form-signin" method="post">
<h2><font style="color:white;">Sign in</font></h2>
<label for="inputEmail" class="sr-only">Username</label>
<input type="username" name="username" id="inputEmail" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"><font style="color:white;">Remember me</font>
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit" name="login">Sign in</button>
</form>
<div>
<?php echo $msg; ?>
</div>
<div class="navbar-inverse navbar-fixed-bottom" role="navigation">
<div class="container-fluid">
<p><center><font style="color:white;">Rosios, Jack P BSIT - 3 © 2015</center></p></font>
</div>
</div>
</div>