public static function getRoles() { $db = Database::getInstance(DatabaseConfig::DB_INSTANCE); $result = $db->prepare("\n SELECT * FROM roles\n "); $result->execute(); $roles = []; if ($result->rowCount() > 0) { $roles = $result->fetchAll(\PDO::FETCH_KEY_PAIR); } return array_flip($roles); }
public function __construct() { $this->db = Database::getInstance(DatabaseConfig::DB_INSTANCE); }
private function isBannedByIP() { $db = Database::getInstance(DatabaseConfig::DB_INSTANCE); $statement = $db->prepare("\n SELECT ip_address FROM blacklist\n "); $statement->execute(); $blacklist = $statement->fetchAll(); if (in_array($_SERVER['REMOTE_ADDR'], $blacklist)) { header("location: http://www.google.com/"); exit; } }