When I try to login in my localhost with XAMPP, there is no error, the log in is successful BUT when I try to log in on the internet (with godaddy) here, it redirects me to the error I created called "http://cosmoonlamps.com/ecom/public/login.php?error=wrongpass" in the header. Please help I am a beginner at this stuff so any help would be much appreciated.
stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("Location: login.php?error=sqlerror");
exit();
} else {
mysqli_stmt_bind_param($stmt, "s", $username);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_assoc($result)) {
$passCheck = password_verify($password, $row['password']);
if ($passCheck == false) {
header("Location: login.php?error=wrongpass");
exit();
} elseif ($passCheck == true) {
session_start();
$_SESSION['id'] = $row['id'];
$_SESSION['username'] = $row['username'];
header("Location: ../../successful.php?success=loggedin");
exit();
} else {
header("Location: ../index.php?error=wrongpass");
exit();
}
}else {
header("Location: login.php?error=nouser");
exit();
}
}
}
}else{
header("Location: login.php?error=accessforbidden");
exit();}
?>
