-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
46 lines (35 loc) · 1.25 KB
/
auth.php
File metadata and controls
46 lines (35 loc) · 1.25 KB
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
<?php
require 'dbConnect.php';
$conn = getConnection();
if($conn->connect_error)
{
header("Location: signUp.php?status=&failed" );
}
$password=$_POST['password'];
$email=$_POST['email'];
$sql = "SELECT * from users where email='$email'";
$result = $conn->query($sql);
// echo $result->num_rows;
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
/*cho "email: " . $row["email"]. " - Name: " . $row["fName"]. " " . $row["password"]. "<br>";*/
$gotEmail=$row["email"];
$gotPassword=$row["password"];
$gotName=$row["first_name"];
$user_id=$row['i_d'];
if($gotPassword!=$password)
{
header("Location: login.php?status=&failed");
}else {
/*session_start();
$_SESSION['userName']=$gotName;
$_SESSION['userEmail']=$gotEmail;*/
header("Location: authSucess.php?user=$gotName&useremail=$gotEmail&userid=$user_id");
}
}
} else {
//header("Location: authSucess.php?user=$gotName&useremail=$gotEmail");
header("Location: login.php?status=&failed");
}
?>