-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhmm_s.php
More file actions
52 lines (47 loc) · 1.09 KB
/
hmm_s.php
File metadata and controls
52 lines (47 loc) · 1.09 KB
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
<?php
$conn=mysqli_connect("localhost","root","","project");
if(isset($_POST['Email']) && isset($_POST['Password']) )
{
function validate($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$Email=validate($_POST['Email']);
$Password=validate($_POST['Password']);
if(empty($Email))
{
header("Location:s_login.php?error=Email is required");
exit();
}
else if(empty($Password))
{
header("Location:s_login.php?error=Password is required");
exit();
}
else{
$sql="select * from students where Email='$Email'
and Password='$Password'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) === 1)
{
$row = mysqli_fetch_assoc($result);
if($row['Email'] === $Email && $row['Password'] === $Password)
{
header("Location: student_dashboard.php?email=$Email");
}
}
else{
header("Location: s_login.php?error=Incorrect Email or Password");
exit();
}
}
}
else
{
header("Location: welcome.php");
exit();
}
?>