-
Notifications
You must be signed in to change notification settings - Fork 3
/
teacher_login.php
73 lines (68 loc) · 3.08 KB
/
teacher_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
<!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.0" />
<title>Student Management System</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/admin_login.css" />
<script src="js/bootstrap.min.js"></script>
<script src="js/juqery_latest.js"></script>
</head>
<body>
<div class="container h-100">
<div class="d-flex justify-content-center h-100">
<div class="user_card">
<div class="d-flex justify-content-center">
<h4 style="padding-top: 40px; position: absolute;">Teachers Login</h4>
</div>
<div class="d-flex justify-content-center form_container">
<form action="" method="post">
<div class="input-group mb-3">
<input type="text" name="email" class="form-control input_user" placeholder="Email">
</div>
<div class="input-group mb-2">
<input type="password" name="password" class="form-control input_pass" placeholder="Password">
</div>
<div class="justify-content-center mt-3 login_container" style="border-radius:20px!important;">
<button style="margin-left:50px;" type="submit" name="submit" class="btn login_btn">Agree</button>
</div>
</form>
</div>
<div class="mt-4">
<div class="d-flex justify-content-center links text-center">
<p s>Don't have an account?<br />Please <span href="" style="fornt-color:#207819;"><a href="teachers_registration_page.php">Registration</a></span></p>
</div>
<div class="text-center">
<a href="index.php" style="color:black; text-decoration: none;">Back to Menu</a>
</div>
</div>
</div>
</div>
</div>
<?php
session_start();
if (isset($_POST['submit'])) {
$connection = mysqli_connect("localhost", "root", "");
$db = mysqli_select_db($connection, "sms");
$query = "select * from teachers where email = '$_POST[email]'";
$query_run = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($query_run)) {
if ($row['email'] == $_POST['email']) {
if ($row['password'] == $_POST['password']) {
$_SESSION['email'] = $row['email'];
$_SESSION['name'] = $row['name'];
$_SESSION['teachers_id'] = $row['teachers_id'];
header("Location: teacher_dashboard.php");
} else {
?>
<center class="align-middle">Wrong Password !!</center>
<?php
}
}
}
}
?>
</body>
</html>