-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
56 lines (46 loc) · 1.55 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
<?php
include ("config.php");
if (isset($_POST['login'])){
$username = $_POST['username'];
$password = $_POST['password'];
$stmt = $con -> prepare("SELECT * FROM users WHERE email= ?");
$stmt -> bind_param("s", $username);
$stmt -> execute();
$check_user = $stmt -> get_result();
if ($check_user -> num_rows !== 0){
$user_data = $check_user -> fetch_assoc();
$hashed_password = $user_data['Password'];
if (password_verify($password, $hashed_password)){
$_SESSION['user'] = $user_data['Firstname'];
$_SESSION['email'] = $user_data['Email'];
header("location:Homepage.php");
exit();
}else{
echo"Wrong Password";
}
}else{
echo "User does not exist";
}
}else{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Ubunifu MIS Login</title>
</head>
<body>
<form action="" method="post">
<div class="avatar">O</div>
<div class="f_title">Ubunifu MIS</div>
<input type="email" name="username" id="" placeholder="Enter your email...">
<input type="password" name="password" id="" placeholder="Password">
<input type="submit" value="Login" name="login">
<div class="f_below"><div class="f_pword">Forgot Password?</div>
<div class="S_up"><a href="Register.php">Sign Up</a></div>
</form></div>
</body>
</html>
<?php } ?>