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");