-
Notifications
You must be signed in to change notification settings - Fork 1
/
student-login.php
56 lines (50 loc) · 1.99 KB
/
student-login.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
<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$myusername = mysqli_real_escape_string($db,$_POST['uname']);
$mypassword = mysqli_real_escape_string($db,$_POST['pwd']);
$sql = "SELECT student_ID FROM students WHERE student_ID = '$myusername' and password = '$mypassword'";
$result = mysqli_query($db, $sql);
if(mysqli_num_rows($result)!=0) {
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$active = $row['active'];
$count = mysqli_num_rows($result);
if($count == 1) {
$_SESSION['login_user'] = $myusername;
header("location: student-home.php");
}
else {
echo '<script>alert("Your Username or Password is invalid")</script>';
}
}
else {
echo '<script>alert("Your Username or Password is invalid")</script>';
}
}
?>
<html>
<head>
<title>WebAES for Students</title>
<meta charset='UTF-8'>
<link rel='stylesheet' type='text/css' href='style.css'>
<link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>
</head>
<body>
<header class='header'>
<h2>WebAES - Student Login</h2>
</header>
<div class='main-content'>
<div class='login-form'>
<h4>Student Login</h4>
<hr>
<form action='' method='POST'>
<input type='text' placeholder='Username' name='uname' autocomplete='off' oninput='this.value = this.value.toUpperCase()' required>
<br>
<input type='password' placeholder='Password' name='pwd' autocomplete='off' required>
<p class='align-center'><button type='submit'>Login</button></p>
</form>
</div>
</div>
</body>
</html>