我有一个登录脚本。它检查我的数据库的用户表以查看这些值是否存在。我在表中添加了一个“close_account”列来控制是否允许用户登录。如果“close_account”=1,他们无法登录,如果“close_account”=0,那么他们可以登录。
我已经有一个 if / else 语句显示使用的登录凭据是否无效(即它们在数据库中不存在)所以我需要额外检查“close_account”标志,以便我可以向告诉他们他们的帐户已被禁用的用户。
这可能吗?
这是我现有的代码:
// Check database to see if email and the hashed password exist there.
$query = "SELECT id, email, close_account ";
$query .= "FROM ptb_users ";
$query .= "WHERE email = '{$email}' ";
$query .= "AND password = '{$hashed_password}' ";
$query .= "AND close_account = '0' ";
$query .= "LIMIT 1";
$result_set = mysql_query($query);
confirm_query($result_set);
redirect_to("dashboard.php");
} else {
// email/password combo was not found in the database
$message = "<div class=\"infobox\"><strong>Email/Password combination incorrect.</strong><br />
Please make sure your caps lock key is off and try again.</div>";
}