diff --git a/app/classes/log.php b/app/classes/log.php index 03ae1d5..7d41af4 100644 --- a/app/classes/log.php +++ b/app/classes/log.php @@ -18,7 +18,11 @@ class Log { * @param object $database The database object to initialize the connection. */ public function __construct($database) { - $this->db = $database->getConnection(); + if ($database instanceof PDO) { + $this->db = $database; + } else { + $this->db = $database->getConnection(); + } } /** diff --git a/app/classes/ratelimiter.php b/app/classes/ratelimiter.php index 5ee17af..04d4a09 100644 --- a/app/classes/ratelimiter.php +++ b/app/classes/ratelimiter.php @@ -23,7 +23,11 @@ class RateLimiter { ]; public function __construct($database) { - $this->db = $database->getConnection(); + if ($database instanceof PDO) { + $this->db = $database; + } else { + $this->db = $database->getConnection(); + } $this->log = new Log($database); $this->createTablesIfNotExist(); }