-
Notifications
You must be signed in to change notification settings - Fork 0
/
student_login.php
77 lines (64 loc) · 1.8 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
include"database.php";
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Advanced Student Portal</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body class="back">
<?php include"navbar.php";?>
<div style="text-align:center;">
<img src="img/logo.png" width="250" height="250">
<div>
<div class="login">
<h1 class="heading">Student Login</h1>
<div class="log">
<?php
if(isset($_POST["login"]))
{
$sql="select * from staff where TNAME='{$_POST["name"]}'and TPASS='{$_POST["pass"]}'";
$res=$db->query($sql);
if($res->num_rows>0)
{
$ro=$res->fetch_assoc();
$_SESSION["TID"]=$ro["TID"];
$_SESSION["TNAME"]=$ro["TNAME"];
echo "<script>window.open('teacher_home.php','_self');</script>";
}
else
{
echo "<div class='error'>Invalid Username Or Password</div>";
}
}
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<label>User ID</label><br>
<input type="text" name="name" required class="input"><br><br>
<label>Password </label><br>
<input type="password" name="pass" required class="input"><br>
<button type="submit" class="btn" name="login">Login</button>
</form>
</div>
</div>
<br>
<br>
<br>
<div class="footer">
<footer><p>Copyright © 2020 </p></footer>
</div>
<script src="js/jquery.js"></script>
<script>
$(document).ready(function(){
$(".error").fadeTo(1000, 100).slideUp(1000, function(){
$(".error").slideUp(1000);
});
$(".success").fadeTo(1000, 100).slideUp(1000, function(){
$(".success").slideUp(1000);
});
});
</script>
</body>
</html>