From 0309886645e0405ccfbde6a1d27ac76139c106b1 Mon Sep 17 00:00:00 2001 From: Joey Date: Fri, 17 Jan 2014 03:53:09 -0500 Subject: [PATCH] What a stupid thing of me to miss UNIX_TIMESTAMP() for time comparison, oops --- public/include/classes/token.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/classes/token.class.php b/public/include/classes/token.class.php index bb947005..902a6b90 100644 --- a/public/include/classes/token.class.php +++ b/public/include/classes/token.class.php @@ -30,7 +30,7 @@ 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 time < NOW() LIMIT 1"); + $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE account_id = ? AND token = ? AND type = ? AND UNIX_TIMESTAMP(time) < NOW() LIMIT 1"); if ($stmt && $stmt->bind_param('isi', $account_id, $token, $type) && $stmt->execute()) return $stmt->get_result()->num_rows; return $this->sqlError();