-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
74 lines (71 loc) · 2.47 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ease</title>
<!-- <link rel="stylesheet" href="ease.css"> -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<ul>
<div style="float: left;">
<li><img src="listen-ear-icon-icons-and-png-backgrounds-26.png" height="100cm" width="100cm"></li>
<li><h1>easƎ Education</h1></li>
</div>
<div style="float: right;">
<li><h1>education for everyone</h1></li>
</div>
</ul>
</header>
<div>
<form class="regform" method="POST">
<div class="input-container">
<input type="text" name="uname" id="uname" required=""><label>UserName</label>
</div>
<div class="input-container">
<input type="password" name="pass" id="pass" required=""><label>Password</label>
</div>
<div>
<input type="submit" name="Submit" class="done" value="login">
</div>
</form>
<div class="reg">
<p class="regi">New to easE Education?</p>
<a href="registration.php">
<button class="regis">register</button>
</a>
</div>
</div>
</body>
</html>
<?php
if(isset($_POST['Submit']))
{
$user = $_POST['uname'];
$pass = $_POST['pass'];
$con = mysqli_connect('localhost','root','','hackathon');
echo($user);
if(mysqli_connect_errno()){
echo "Failed to connect to MySQL: ".mysqli_connect_error();
}
else{
$search = "SELECT * FROM `user` WHERE userName='$user' ";
$result = mysqli_query($con,$search);
$pass_search = "SELECT * FROM `user` WHERE Password='$pass' ";
$pass_result=mysqli_query($con,$pass_search);
if(mysqli_num_rows($result)==1){
if(mysqli_num_rows($pass_result)==1){
echo"<script>alert('Succcess');location.replace('hack/q.html')</script>";
}
else{
echo"Invalid Password";
}
}
else{
echo"Invalid username!";
}
}
mysqli_close($con);
}
?>