-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
45 lines (42 loc) · 1.01 KB
/
login.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
<?php
include_once 'includes/db.php';
session_start();
$loginError = '';
if(isset($_POST['userNumber']))
{
$userNumber = user_input($_POST['userNumber']);
$userPwd = user_input($_POST['userPwd']);
$session = "";
if($userNumber=="" || $userPwd=="")
{
$loginError = "Please fill all fields";
}
else
{
$query = "SELECT * FROM registration WHERE email='$userNumber' AND status='1' LIMIT 1;";
$result = mysqli_query($conn, $query);
$rows = mysqli_num_rows($result);
if($rows > 0)
{
while ($row_data = mysqli_fetch_assoc($result))
{
$hashed_password = $row_data['password'];
$session = $row_data['email'];
}
if(password_verify($userPwd, $hashed_password))
{
$_SESSION['CarUserEmail'] = $session;
$loginError = 'success';
}
else
{
$loginError = 'Wrong password';
}
}
else
{
$loginError = "Email not registered";
}
}
echo "$loginError";
}