-
Notifications
You must be signed in to change notification settings - Fork 2
/
adminLogin.php
62 lines (59 loc) · 2.12 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
<?php
$username = filter_input(INPUT_POST, 'username');
$password = md5(filter_input(INPUT_POST, 'password'));
session_start();
$_SESSION['username'] = $username;
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(!empty($username) && !empty($password)){
$host = "localhost";
$user = "root";
$pwd = "";
$dbname = "lms";
// Create connection
$conn = new mysqli($host, $user, $pwd, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM adminregistration WHERE username = '$username' AND password = '$password'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
header('Location: addBook.php');
}
else
{
header('Location: wrongId.php');
}
$conn->close();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>
Library Managemenr System
</title>
<link rel="stylesheet" type="text/css" href="CSS/adminLoginStyle.css">
</head>
<body background="Images/home.jpg">
<center>
<div>
<img src="Images/home1.jpg" class = "topImage">
</div>
<br>
<div id = "bottomLayout">
<div id ="bottom-left"><a href = "adminLogin.php" id = "linkAdmin"><img src = "Images/admin.png" height = "200" width = "200" id = "imageL"></a><br><p id ="bottomContentLeft"> Admin Login</p></div>
<div id ="bottom-right">
<form action="adminLogin.php" method = "POST">
<table id = "formLayout" cellspacing="10">
<tr id = "rowLayout"><td id="rowHeading"> Username:</td><td><input type="text" name="username" id = "input"></td></tr>
<tr id = "rowLayout"><td id="rowHeading"> Password:</td><td><input type="password" name="password" id = "input"></td></tr>
</table>
<br><center><input type="submit" value="Login" id="buttonFont"></center><br>
</form>
</div>
</div>
</center>
</body>
</html>