-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
47 lines (43 loc) · 1.25 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
<?php
ob_start ();
session_start();
require "php/config.php";
require_once "php/functions.php";
$user = new login_registration_class();
if($user->get_admin_session()){
header('Location: admin.php');
exit();
}
?>
<?php
$pageTitle = "Admin Login";
?>
<?php include "header.php"; ?>
<div class="loginform fix">
<div class="msg "><h3><i class="fa fa-user" aria-hidden="true"></i> Admin login</h3></div>
<div class="access">
<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) or empty($password)){
echo "<p style='color:red;text-align:center;'>Field must not be empty.</p>";
}else{
$password = md5($password);
$login = $user->admin_userlogin($username, $password);
if($login){
header('Location: admin.php');
}else{
echo "<p style='color:red;text-align:center'>Incorrect username or password</p>";
}
}
}
?>
<form action="" method="post">
<input type="text" name="username" placeholder="username" />
<input type="password" name="password" placeholder="username" />
<input type="submit" value="Login" />
</form>
</div>
</div>
<?php include "footer.php"; ?>