-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcheck.php
47 lines (31 loc) · 1.09 KB
/
check.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
<html>
<head>
<link rel="stylesheet" href="button.css">
<link rel="stylesheet" href="button2.css">
<body>
<form action="subjects.php" method="POST">
<?php
$uname=mysql_real_escape_string($_POST['uname']);
$pass=mysql_real_escape_string($_POST['pass']);
$conn=mysqli_connect('mysql.hostinger.in','u662065187_sas','@toor5','u662065187_atten');
$query="SELECT * from faculty where uname='$uname' AND pass='$pass'";
//you were just verifying the username not the password and it will lead to the authetication bypass
//as any user can just enter the username of the person and boom he got logged in without any password
$result=mysqli_query($conn,$query)or header('Location:flogin.html');
$row=$result->fetch_assoc();
if($row['pass']==$_POST['password'])
{
session_start();
$_SESSION[$_POST['uname']]=$_POST['password'];
echo "<center><h2>Welcome Prof.".$row['fullname']."</h2></center><br><br><br><br><br>";
echo "<input type=\"hidden\" name=\"uname\" value=\"".$_POST['uname']."\" >";
echo "<input type=\"submit\" value=\"Next\" >";
}
else
{
header('Location:flogin.html');
}
?>
</form>
</body>
</html>