-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminlogin.php
149 lines (93 loc) · 2.99 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
session_start();
if(isset($_POST["login"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$db = mysqli_connect("localhost","root","root","car_showroom");
$query=mysqli_query($db,"SELECT * FROM admin WHERE admin_name='".$user."' AND admin_pass='".$pass."'");
$numrows = mysqli_num_rows($query);
if($numrows !=0)
{
while($row=mysqli_fetch_assoc($query))
{
$dbusername=$row['admin_name'];
$dbpass=$row['admin_pass'];
}
if($user == $dbusername && $pass == $dbpass)
{
$_SESSION['admin_name']= $dbusername;
/* Redirect browser */
header("Location: admin.php");
}
}
else
{
echo "Invalid username or password!";
}
}
else {
echo "All fields are required!";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="header">
<div class="wrap">
<div class="header-bot">
<div class="logo">
<a href="index.html"><img src="images/logo.png" alt="" style ="width:450px; height: 160px;"></a>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="header-bottom">
<div class="wrap">
<h1 class="text-center"><u>ADMINISTRATOR</u></h1>
<div class="page-not-found">
<div class="text-center">
<h2>SIGN IN
</h2>
</div>
<div class="container-fluid row">
<div class="col-md-3"></div>
<div class="col-md-6">
<form class="text-center" action="adminlogin.php" method="post" >
<div ><br/>
<label>USERNAME</label>
<input type="text" class="form-control transparent-input" size="50" placeholder="" name="user" required >
</div>
<div ><br/>
<label>PASSWORD</label>
<input type="password" class="form-control transparent-input" size="50" placeholder="" name="pass" required>
</div>
<div><br/>
<button type="submit" class="btn btn-primary" value="login" name="login">Sign in</button>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="wrap">
<div class="footer-top">
</div>
</div>
</div>
</body>
</html>