-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidation.php
39 lines (29 loc) · 904 Bytes
/
validation.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
<?php
include('connection.php');
$email = $_POST['email'];
$pass = $_POST['password'];
$email_search = "select * from users where email = '$email'";
$query = mysqli_query($con,$email_search);
$email_count=mysqli_num_rows($query);
if($email_count == 1){
$email_pass = mysqli_fetch_assoc($query);
$db_pass = $email_pass['password'];
$pass_decode = password_verify($pass, $db_pass);
if($pass_decode){
$_SESSION['email'] = $email;
header('location:main.php');
}
else{
echo "<script type=\"text/javascript\">\n";
echo "alert('Invalid Password.');\n";
echo "window.location = ('index1.php');\n";
echo "</script>";
}
}
else{
echo "<script type=\"text/javascript\">\n";
echo "alert('Invalid E-mail.');\n";
echo "window.location = ('index1.php');\n";
echo "</script>";
}
?>