table_security_failedlog.php
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_security_failedlog.php 28862 2012-03-15 08:30:54Z songlixin $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_security_failedlog extends discuz_table {
public function __construct() {
$this->_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);
}
}