-
Notifications
You must be signed in to change notification settings - Fork 30
/
signinHandle.php
65 lines (51 loc) · 1.64 KB
/
signinHandle.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
<?php
$showerror=false;
session_start();
if(isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true){
header('location:profile.php');
}
if ($_SERVER['REQUEST_METHOD']=='POST') {
$infidoremail=$_POST['infid/email'];
$pass=$_POST['password'];
// $email=$_POST['email'];
include 'connect.php';
$sql="SELECT * FROM `participant` WHERE `InfId`='$infidoremail'";
$result=mysqli_query($conn,$sql);
$sql1="SELECT * FROM `participant` WHERE `Email`='$infidoremail'";
$result1=mysqli_query($conn,$sql1);
$num=mysqli_num_rows($result);
$num1=mysqli_num_rows($result1);
if ($num==1) {
$row=mysqli_fetch_assoc($result);
$hash=$row['Password'];
$verification=password_verify($pass,$hash);
if ($verification) {
session_start();
$_SESSION['loggedin']=true;
$_SESSION['infid']=$row['InfId'];
$_SESSION['email']=$row['Email'];
header("location:profile.php");
}
else{
$showerror="Error! Wrong password";
}
}
else if($num1==1){
$row=mysqli_fetch_assoc($result1);
$hash=$row['Password'];
$verification=password_verify($pass,$hash);
if ($verification) {
session_start();
$_SESSION['loggedin']=true;
$_SESSION['infid']=$row['InfId'];
$_SESSION['email']=$row['Email'];
header("location:profile.php");
}
else{
$showerror="Error! Wrong password";
}
}
else{
$showerror= "Error! Invalid credentials";
}
}