What a stupid thing of me to miss
UNIX_TIMESTAMP() for time comparison, oops
This commit is contained in:
parent
a572d0cea0
commit
0309886645
@ -30,7 +30,7 @@ class Token Extends Base {
|
|||||||
* @return int 0 or 1
|
* @return int 0 or 1
|
||||||
*/
|
*/
|
||||||
public function isTokenValid($account_id, $token, $type) {
|
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())
|
if ($stmt && $stmt->bind_param('isi', $account_id, $token, $type) && $stmt->execute())
|
||||||
return $stmt->get_result()->num_rows;
|
return $stmt->get_result()->num_rows;
|
||||||
return $this->sqlError();
|
return $this->sqlError();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user