<?php class Blacklist extends Model { // =========== // = Statics = // =========== protected static $table_name = 'MJ_BLACKLIST'; public static function getList() { $stm = parent::exec('GET_BLACKLIST'); return $stm->fetchAll(); } public static function isBannedIP($ip) { $stm = parent::exec('CHECK_BLACKLIST', ['ip' => $ip]); $result = $stm->fetch(); if($result){ return true; } return false; } public static function addIP($ip) { $begin_date = date('Y-m-d'); $pimped_array = ['ip'=>$ip,'date'=>$begin_date]; $stm = parent::exec('ADD_BLACKLIST', $pimped_array); } public static function removeIP($ip) { $stm = parent::exec('REMOVE_BLACKLIST', ['ip' => $ip]); } public function ip() { return trim($this->IP); } }