_table = 'security_failedlog'; $this->_pk = 'id'; parent::__construct(); } public function deleteDirtyLog() { DB::delete($this->_table, 'pid = 0 AND tid = 0 AND uid = 0 OR lastfailtime = 0 OR failcount >= 10'); return true; } public function fetch_by_pid($pid) { return DB::fetch_first('SELECT * FROM %t WHERE ' . DB::field('pid', $pid) . ' ' . DB::limit(0, 1), array($this->_table), $this->_pk); } public function fetch_by_uid($uid) { return DB::fetch_first('SELECT * FROM %t WHERE ' . DB::field('uid', $uid) . ' ' . DB::limit(0, 1), array($this->_table), $this->_pk); } public function range_by_pid($pid, $start = 0, $limit = 5) { return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('pid', $pid) . ' ' . DB::limit($start, $limit), array($this->_table), $this->_pk); } public function range_by_uid($uid, $start = 0, $limit = 5) { return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('uid', $uid) . ' ' . DB::limit($start, $limit), array($this->_table), $this->_pk); } }