-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
86 lines (74 loc) · 3.7 KB
/
Copy pathindex.php
File metadata and controls
86 lines (74 loc) · 3.7 KB
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
<html>
<head>
<title>Welcome | Library Management System</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description">
<meta content="Coderthemes" name="author">
<!-- App favicon -->
<link rel="shortcut icon" href="assets/images/favicon.ico">
<link href="assets/css/vendor/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css">
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/app.min.css" rel="stylesheet" type="text/css" id="light-style">
</head>
<body>
<section style="background-color: #313a46; height: 100vh">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col col-xl-10">
<div class="card" style="border-radius: 1rem;">
<div class="row">
<div class="col-md-6 col-lg-5 d-none d-md-block ">
<img src="images/library1.jpg" class="img-fluid" style="border-radius: 1rem 0 0 1rem;" />
</div>
<div class="col-md-6 col-lg-7 d-flex align-items-center">
<div class="card-body p-4 p-lg-5 text-black">
<form action="index.php" method="POST">
<div class="d-flex align-items-center mb-3 pb-1">
<span class="h1 fw-bold mb-0">Library Management System</span>
</div>
<div class="form-outline mb-4">
<input type="text" class="form-control form-control-lg" name="username" required />
<label class="form-label">Username</label>
</div>
<div class="form-outline mb-4">
<input type="password" class="form-control form-control-lg" name="password" required />
<label class="form-label" for="form2Example27">Password</label>
</div>
<div class="pt-1 mb-4 text-center">
<input type="submit" class="btn btn-dark btn-lg btn-block" value="Login" name="submit">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
<?php
include('dbconnect.php');
if (!isset($_POST['username'], $_POST['password'])) {
echo ' <script> Please fill both the username and password fields! </script>';
}
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == "" || $password == "") {
echo "<script> Please fill both the username and password fields! </script>";
exit();
}
$Query = "SELECT admin_id FROM admin WHERE username = '$username' AND password = '$password'";
$result = mysqli_query($conn, $Query);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if ($count == 1) {
echo "<script>
window.location.href='app/book/book.php'</script>";
} else {
echo "<script> alert('Login Failed. Check your email or password')
window.location.href='index.php'
</script>";
}
?>