-
Notifications
You must be signed in to change notification settings - Fork 4
/
login.php
52 lines (47 loc) · 1.65 KB
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/840b1ebd19.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<title>Online Examinaton in India | MyExam.com</title>
</head>
<body>
<form method="post" action="login.php">
<div class="container">
<h1>Login To Online Examination</h1>
<div class="box">
<i class="fa fa-envelope-o"></i>
<input type="text" name="username" placeholder="Enter your Username">
</div>
<div class="box">
<i class="fa fa-key"></i>
<input type="password" name="password" placeholder="Enter your password">
</div>
<input class="btn" type="submit" name="submit" value="Login"/>
<a style="text-decoration:none" href="register.php" class="btn">Register</a>
</div>
</form>
</body>
</html>
<?php
include("config.php");
if(isset($_POST['submit']))
{
$username = $_POST['username'];
$password = $_POST['password'];
$query = "select * from registration where username='$username' && password='$password'";
$data = mysqli_query($con, $query);
$total = mysqli_num_rows($data);
if($total == 1)
{
$_SESSION['username'] = $username;
header('location:home.php');
}else{
echo "Login Fialed";
}
}
?>