This is a page in progress... When I test and purposely enter an incorrect password, it never gets to the part of the if else statement that should say the password is incorrect (it skips to the default message of "please log in..."). However, it does recognize when I enter the correct password and whether the account is expired. Any ideas?
$email = $_POST['email'];
$password = md5($_POST['password']);
$query = " SELECT expiration_date
FROM users
WHERE email='$email'
AND password='$password'
LIMIT 1";
$result = mysql_query($query);
if($result){
while($row = mysql_fetch_object($result)){
$remaining = (strtotime($row->expiration_date))-time();
if($remaining>0)
$msg = "You are logged in as $email.";
else if($remaining<=0)
$msg = "Your account is expired.";
else
$msg = "Incorrect email address or password.";
}//end of while
}//end of if result
if(!$msg)
$msg = "Please log in to your account. ";
I've also tried changing the line to
else if ($remaining)
$msg = "Incorrect email address or password.";