-
Notifications
You must be signed in to change notification settings - Fork 6
/
adminlogin.php
141 lines (89 loc) · 4.02 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>SLOCV Unit</title>
<link rel="icon" type="image/png" href="228-2285847_emblem-of-sri-lanka-national-emblem-of-sri.png">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<style>
#login .container #login-row #login-column #login-box {
margin-top: 220px;
max-width: 600px;
height:550px;
color: white;
align: center;
}
#login .container #login-row #login-column #login-box #login-form {
padding: 10px;
text-align: left;
}
#login .container #login-row #login-column #login-box #login-form #register-link {
margin-top: 15px;
text-align: right;
color: aliceblue;
}
</style>
</head>
<body style="background-color: grey">
<?php
session_start();
$message="";
if(isset($_POST['submit'])){
//include the database
if(count($_POST)>0) {
include 'DBconnection.php';
$result = mysqli_query($conn,"SELECT * FROM admins WHERE adminEmail='" . $_POST["username"] . "' and password = '". $_POST["password"]."'");
$row = mysqli_fetch_array($result);
if(is_array($row)) {
$_SESSION["id"] = $row['id'];
$_SESSION["email"] = $row['adminEmail'];
$_SESSION["name"] = $row['name'];
} else {
$message = "Invalid ID or Password!";
}
}
if(isset($_SESSION["id"])) {
header("Location:adminindex.php");
}
}
?>
<div class="div_content_login">
<div class="login_index">
<div id="login">
<div class="container">
<div id="login-row" align="center">
<div id="login-column" align="center">
<div id="login-box" align="center">
<form id="login-form" class="form" method="post">
<h1 style="color: darkred" align="center"><i class="fas fa-shield-virus"></i>Admin Login</h1>
<div class="form-group">
<label style="color: darkred" for="username" class="col-sm-3 control-"><i class="fas fa-shield-virus"></i>Admin Username</label>
<input type="text" name="username" id="username" class="form-control" required>
</div>
<div class="form-group">
<label style="color: darkred" for="password" class="col-sm-3 control-label"><i class="fas fa-shield-virus"></i>Admin Password</label>
<input type="password" name="password" id="password" class="form-control" required>
</div>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-primary btn-block" value="Log In">
<div class="alert-danger"><h4> <?php if($message!="") { echo $message; } ?></h4>
</div>
</form>
<button class="btn btn-danger btn-block" ><a style="color: white" href="index.php">Back To Main Menu</a></button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>