-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
177 lines (81 loc) · 3.66 KB
/
index.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" href="w3.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php include 'header.php';?>
<?php
require('db.php');
session_start();
// If form submitted, insert values into the database.
if (isset($_POST['username'])){
$username = stripslashes($_REQUEST['username']); // removes backslashes
$username = mysqli_real_escape_string($con,$username); //escapes special characters in a string
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($con,$password);
//Checking is user existing in the database or not
$query = "SELECT * FROM `users` WHERE username='$username' and password='".md5($password)."'";
$result = mysqli_query($con,$query) or die(mysqli_error());
$rows = mysqli_num_rows($result);
if($rows==1){
$_SESSION['username'] = $username;
header("Location:index.php"); // Redirect user to index.php
}
}
?>
<div class="form">
<body>
<!--<marquee>THE STUDENT LOGING IS AVAILABLE SOON -Admin</marquee>-->
<div class="w3-container">
<center><h2> Click Here To Login...</h2></center>
<center><button align="center" onclick="window.location.href='principal/login.php'" class="w3-button w3-green w3-large" style="width:auto;">Principal Login</button></center><br/>
<center><button align="center" onclick="window.location.href='hod/hod_login.php'" class="w3-button w3-green w3-large" style="width:auto;">HOD Login</button></center>
<br/>
<!--<center><button align="center" onclick="window.location.href='letc/letc_login.php'" class="w3-button w3-green w3-large" style="width:auto;">Lecturer Login</button></center><br/> -->
<center><button align="center" onclick="window.location.href='student'" class="w3-button w3-green w3-large" style="width:auto;">Student Login</button></center>
<br/>
<div id="id01" class="w3-modal w3-animate-opacity">
<div class="w3-modal-content w3-card-4 w3-animate-zoom" style="max-width:600px">
<div class="w3-center">
<span onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-xlarge w3-hover-red w3-display-topright" title="Close Modal">×</span>
<img src="logo.png" style="height:200px;width:200px;" alt="Avatar" class="w3-circle w3-margin-top">
</div>
<form class="w3-container" method="POST">
<div class="w3-container">
<label for="uname"><b>Username</b></label>
<input type="text" class="w3-input w3-border w3-margin-bottom" placeholder="Enter Username" name="username" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" class="w3-input w3-border w3-margin-bottom" name="password" required>
<button class="w3-button w3-block w3-green w3-section w3-padding" type="submit">Login</button>
</div>
</form>
<div class="w3-container w3-border-top w3-padding-16 w3-light-grey" style="background-color:#f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-red">Cancel</button>
<!--<span class="psw"> not register <a href="#">Click Here!</a></span>-->
</div>
</div>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById('id01');
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</form>
<br /><br />
</div>
</body>
<?php include 'footer.php';?>
</html>