From bacbb8c36c047eae9841b5a5022b25d8a744c77a Mon Sep 17 00:00:00 2001 From: xisi Date: Fri, 17 Jan 2014 18:04:29 -0500 Subject: [PATCH] after looking into this quite a bit, this is the correct way to do it after all --- public/include/classes/token.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/include/classes/token.class.php b/public/include/classes/token.class.php index 902a6b90..be7160ab 100644 --- a/public/include/classes/token.class.php +++ b/public/include/classes/token.class.php @@ -30,9 +30,12 @@ class Token Extends Base { * @return int 0 or 1 */ public function isTokenValid($account_id, $token, $type) { - $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE account_id = ? AND token = ? AND type = ? AND UNIX_TIMESTAMP(time) < NOW() LIMIT 1"); + $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE account_id = ? AND token = ? AND type = ? AND UNIX_TIMESTAMP(time) < UNIX_TIMESTAMP(NOW()) LIMIT 1"); + if ($stmt && $stmt->bind_param('isi', $account_id, $token, $type) && $stmt->execute()) - return $stmt->get_result()->num_rows; + $res = $stmt->get_result(); + print_r($res); + return $res->num_rows; return $this->sqlError(); }