php - Wrong email password
Get the solution ↓↓↓Solution:
ob_start()
turns on output buffering; nothing will display to the screen until you expressly retrieve the contents of the output buffer and stop buffering (e.g., with or a similar function). You haven't done that, so you don't get any output, even though you used
echo
.
You need to tweak thatif
/else
block like this:
if ($user == 1) {
$_SESSION['current_user'] = $email;
header("Location: edit_profile.php");
exit();
} else {
ob_end_clean(); // add this line
$error = "Wrong Email and Password";
}
Also, your code has several big problems:
- Please don't use
; the
mysql_*
functions are outdated, deprecated, and insecure. Useor
instead.
- You are wide open to . Right now, it's trivial to log in as the admin, even without proper permissions.
- You're using the insecure and broken MD5 to hash your passwords. Don't do this. Use a safe and modern library like bcrypt.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot use isset() on the result of an expression (you can use "null !== expression" instead)
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.