-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminlogin.php
70 lines (60 loc) · 1.92 KB
/
adminlogin.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<title>Nabila Car Rental</title>
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/responsive.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<section class="">
<?php
include 'header.php';
?>
<div class="wrapper">
<div id="fom">
<form method="post" action="adminlogin.php">
<h3 style="text-align:center; color: #000099; font-weight:bold; text-decoration:underline">Admin Login Area</h3>
<table height="100" align="center">
<tr>
<td>Email Address:</td>
<td><input type="text" name="uname" placeholder="Enter Username" required></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass" placeholder="Enter Password" required></td>
</tr>
<tr>
<td colspan="2" style="text-align:center"><input type="submit" name="login"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['login'])){
include 'includes/config.php';
$uname = $_POST['uname'];
$pass = $_POST['pass'];
$query = "SELECT * FROM admin WHERE uname = '$uname' AND pass = '$pass' ";
mysqli_query($db, $query) or die('Error querying database.');
$result = mysqli_query($db, $query);
$row = mysqli_fetch_array($result);
if($row > 0){
session_start();
$_SESSION['uname'] = $row['uname'];
$_SESSION['pass'] = $row['pass'];
echo "<script type = \"text/javascript\">
alert(\"Login Successful.................\");
window.location = (\"admin/add_vehicles.php\")
</script>";
} else{
echo "<script type = \"text/javascript\">
alert(\"Login Failed. Try Again................\");
window.location = (\"adminlogin.php\")
</script>";
}
}
?>
</div>
</body>
</html>