-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
78 lines (61 loc) · 2.2 KB
/
admin.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
<?php
@ob_start();
session_start();
include("db/dbh.php");
if (isset($_POST['login-btn'])) {
$admin_id = $_POST['admin_id'];
$password = $_POST['password'];
$sql = "SELECT * FROM admin WHERE admin_id='$admin_id' AND password='$password'";
$result = mysqli_query($conn,$sql);
if (!$row=mysqli_fetch_assoc($result)) {
$_SESSION['errMsg']="username/password combination incorrect";
}else
{
$_SESSION['name']=$row['name'];
$_SESSION['admin_id']=$row['admin_id'];
$_SESSION['admin_loggedin'] = true;
header("location:admin_home.php");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin Login-Canteen System</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" /><!-- bootstrap css -->
<link href="css/contact.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" /><!-- contact css -->
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="icon" href="img/favicon.ico" type="image/gif" sizes="32x32">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="innerpages_banner">
<img src="img/hdr.png">
<h1>Canteen Management System</h1>
</div>
<?php
if (isset($_SESSION['errMsg'])) {
echo "<div class='errMsg'>
<div class='invalid'>Invalid Login</div>
<div class='msg' style='padding-top: 5px;'>".$_SESSION['errMsg']."</div></div>";
unset($_SESSION['errMsg']);
}
?>
<div class="login">
<form action="admin.php" method="POST">
<div class="input">
<img src="img/admin_img.png">
<br><br>
<input type="text" name="admin_id" id="admin_id" required class="form-input" placeholder="Admin ID" autofocus></input>
<input type="password" name="password" id="password" placeholder="Password" required class="form-input"></input>
<br>
<button type="submit" name="login-btn" class="btn-login">Login</button>
<a href="index.php" target="_top" style="text-decoration: none;color: white;border: 1px solid white; border-radius: 5px;padding: 15px 30px 15px;margin-left: 20px; font-family: arial;">
Back</a>
<br>
</div>
</form>
</div>
</body>
</html>