-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
92 lines (76 loc) · 2.89 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
session_start();
include 'db_con.php';
if(isset($_POST['submit'])) {
$email = $_POST['email'];
$password = $_POST['password'];
// Email Search
$email_search = "select * from register where email = '$email'";
$query = mysqli_query($con, $email_search);
// checks if email is registered or not
$email_count = mysqli_num_rows($query);
if($email_count) {
$email_pass = mysqli_fetch_assoc($query);
$db_pass = $email_pass['fpassword'];
$_SESSION['fullname'] = $email_pass['fullname'];
$match = password_verify($password, $db_pass);
if($match) {
echo 'login';
header('location:home.php');
}
else {
echo '<div style="font-size: 18px; color: red">Incorrect Email or Password</div>';
}
}
else {
echo '<div style="font-size: 18px; color: red">email not found</div>';
}
}
?>
<!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>Login</title>
<link rel="stylesheet" href="./css/style.css">
<!-- google reCaptcha -->
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<div class="form_layout">
<form id="form" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" class="form_container" method="POST">
<h1>Login</h1>
<div class="field">
<input type="text" name="email" autocomplete="off" required>
<label for="email" class="label-name">
<span class="content-name">Email</span>
</label>
</div>
<div class="field">
<input type="password" name="password" autocomplete="off" required>
<label for="password" class="label-name">
<span class="content-name">Password</span>
</label>
</div>
<!-- Google reCaptcha -->
<div class="g-recaptcha" data-sitekey="6LcOJ6QgAAAAAOIuIKA4fDfUDVTse3fICI1B-YEG" data-callback="enableBtn"></div>
<div class="btn">
<button name="submit" type="submit" class="button" id="submit" disabled="disabled">
<span class="btn_text">Login</span>
</button>
<script type="text/javascript">
// JS to enable button only if captcha is solved
function enableBtn() {
document.getElementById("submit").disabled = false;
}
</script>
</div>
<div class="link">
<p>Need to <span><a href="./signup.php">Signup</a></span>? </p>
</div>
</form>
</div>
</body>
</html>