-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvalidation.php
38 lines (31 loc) · 1.08 KB
/
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
<?php
session_start();
include "db_connect.php";
if(isset($_POST['submit'])){
$email=$_POST['email'];
$password=$_POST['password'];
$email_query="select * from users where email='$email'"; //email checking
$query=mysqli_query($con,$email_query);
$email_count=mysqli_num_rows($query);
if($email_count){
$email_pass = mysqli_fetch_assoc($query);
$db_pass=$email_pass['password'];
$_SESSION['username']=$email_pass['username']; //to display in the frontEnd
$_SESSION['password']=$email_pass['password'];
$_SESSION['email']=$email_pass['email'];
$_SESSION['mobileNumber']=$email_pass['mobileNumber'];
$pass_decode=password_verify($password,$db_pass);
if($pass_decode){
echo "<script>location.href='home.php'</script>";
}
else{
echo "<script>alert('Password is Incorrect')</script>";
echo "<script>location.href='index.php'</script>";
}
}
else{
echo "<script>alert('Invalid Email')</script>";
echo "<script>location.href='index.php'</script>";
}
}
?>