我正在尝试向我的登录添加一个查询,以检查我的 sql 表中的 'subscription_expires' 列。这基本上检查用户的会员资格是否已过期,如果日期是当前日期 + 那么它应该重定向到另一个页面吗?
这是我的代码,但我不知道如何检查 subscription_expires 日期是否为当前日期 +
有人可以告诉我我该怎么做吗?谢谢。
// 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);
if (mysql_num_rows($result_set) == 1) {
// email/password authenticated
// and only 1 match
$found_user = mysql_fetch_array($result_set);
$_SESSION['user_id'] = $found_user['id'];
$_SESSION['email'] = $found_user['email'];
$_SESSION['sub_expires'] = $found_user['subscription_expires'];
$_SESSION['logged_in'] = true;
$result = mysql_query("UPDATE ptb_users SET user_online='Online' WHERE id=".$_SESSION['user_id']."")
or die(mysql_error());
redirect_to("dashboard.php");