forked from skol-1/medical-imaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login-process.php
42 lines (33 loc) · 1.01 KB
/
login-process.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
<?php
$error = array();
$email = validate_input_email($_POST['email']);
if (empty($email)){
$error[] = "You forgot to enter your Email";
}
$password = validate_input_text($_POST['password']);
if (empty($password)){
$error[] = "You forgot to enter your password";
}
if(empty($error)){
// sql query
$query = "SELECT userID, firstName, lastName, email, password, profileImage FROM user WHERE email=?";
$q = mysqli_stmt_init($con);
mysqli_stmt_prepare($q, $query);
// bind parameter
mysqli_stmt_bind_param($q, 's', $email);
//execute query
mysqli_stmt_execute($q);
$result = mysqli_stmt_get_result($q);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
if (!empty($row)){
// verify password
if(password_verify($password, $row['password'])){
header("location: start-session.php");
exit();
}
}else{
print "You are not a member please register!";
}
}else{
echo "Please Fill out email and password to login!";
}