table_security_failedlog.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_security_failedlog.php 28862 2012-03-15 08:30:54Z songlixin $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_security_failedlog extends discuz_table {
  12. public function __construct() {
  13. $this->_table = 'security_failedlog';
  14. $this->_pk = 'id';
  15. parent::__construct();
  16. }
  17. public function deleteDirtyLog() {
  18. DB::delete($this->_table, 'pid = 0 AND tid = 0 AND uid = 0 OR lastfailtime = 0 OR failcount >= 10');
  19. return true;
  20. }
  21. public function fetch_by_pid($pid) {
  22. return DB::fetch_first('SELECT * FROM %t WHERE ' . DB::field('pid', $pid) . ' ' . DB::limit(0, 1), array($this->_table), $this->_pk);
  23. }
  24. public function fetch_by_uid($uid) {
  25. return DB::fetch_first('SELECT * FROM %t WHERE ' . DB::field('uid', $uid) . ' ' . DB::limit(0, 1), array($this->_table), $this->_pk);
  26. }
  27. public function range_by_pid($pid, $start = 0, $limit = 5) {
  28. return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('pid', $pid) . ' ' . DB::limit($start, $limit), array($this->_table), $this->_pk);
  29. }
  30. public function range_by_uid($uid, $start = 0, $limit = 5) {
  31. return DB::fetch_all('SELECT * FROM %t WHERE ' . DB::field('uid', $uid) . ' ' . DB::limit($start, $limit), array($this->_table), $this->_pk);
  32. }
  33. }