From 645e98cd6a17259dfb9f8429a07352b7dc537b6f Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Tue, 10 Dec 2024 15:56:58 +0200 Subject: [PATCH] Clear extra spaces --- app/classes/ratelimitrer.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/classes/ratelimitrer.php b/app/classes/ratelimitrer.php index 98c9926..138cf4a 100644 --- a/app/classes/ratelimitrer.php +++ b/app/classes/ratelimitrer.php @@ -113,10 +113,10 @@ class RateLimiter { } public function tooManyAttempts($username, $ipAddress) { - $sql = "SELECT COUNT(*) as attempts - FROM {$this->tableName} - WHERE ip_address = :ip - AND username = :username + $sql = "SELECT COUNT(*) as attempts + FROM {$this->tableName} + WHERE ip_address = :ip + AND username = :username AND attempted_at > datetime('now', '-' || :minutes || ' minutes')"; $stmt = $this->db->prepare($sql); @@ -131,7 +131,7 @@ class RateLimiter { } public function clearOldAttempts() { - $sql = "DELETE FROM {$this->tableName} + $sql = "DELETE FROM {$this->tableName} WHERE attempted_at < datetime('now', '-' || :minutes || ' minutes')"; $stmt = $this->db->prepare($sql); @@ -141,10 +141,10 @@ class RateLimiter { } public function getRemainingAttempts($username, $ipAddress) { - $sql = "SELECT COUNT(*) as attempts - FROM {$this->tableName} - WHERE ip_address = :ip - AND username = :username + $sql = "SELECT COUNT(*) as attempts + FROM {$this->tableName} + WHERE ip_address = :ip + AND username = :username AND attempted_at > datetime('now', '-' || :minutes || ' minutes')"; $stmt = $this->db->prepare($sql);