The "Wrong Email and Password" message doesn't show up when I incorrectly fill out the form.
I have ob_start();
in the beginning of my code - does this cause anything? If I erase ob_start();
, I have errors of:
Cannot modify header information
How do I fix this?
<?php
if (isset($_POST['login'])) {
$email = $password = $error = "";
$email = $_POST['email'];
$password = md5($_POST['password']);
if (empty($email) || empty($password)) {
$error = "Please enter your Email and Password!";
} else {
$sql = "SELECT * FROM tbl_users WHERE email='$email' && password='$password'";
$res = mysql_query($sql);
$user = mysql_num_rows($res);
if ($user['blocked'] == 'YES') {
$error = "Your Account has been blocked. Please contact us for more info";
} else {
if ($user == 1) {
$_SESSION['current_user'] = $email;
header("Location: edit_profile.php");
exit();
} else {
$error = "Wrong Email and Password";
}
}
}
}
?>