table_common_member_validate.php
2.21 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
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_common_member_validate.php 27848 2012-02-15 09:07:27Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_common_member_validate extends discuz_table
{
public function __construct() {
$this->_table = 'common_member_validate';
$this->_pk = 'uid';
parent::__construct();
}
public function fetch_all_validate_uid($submittimes = '', $regdate = '', $moddate = '', $regip = '') {
$sql = 'm.groupid=8';
$sql .= $submittimes ? ' AND v.submittimes>'.intval($submittimes) : '';
$sql .= $regdate ? ' AND m.regdate<'.(TIMESTAMP - intval($regdate) * 86400) : '';
$sql .= $moddate ? ' AND v.moddate<'.(TIMESTAMP - intval($moddate) * 86400) : '';
$sql .= ($regip = stripsearchkey(addslashes((string)$regip))) ? " AND m.regip LIKE '".$regip."%'" : '';
return DB::fetch_all("SELECT v.uid FROM ".DB::table('common_member_validate')." v, ".DB::table('common_member')." m
WHERE $sql AND m.uid=v.uid", null, 'uid');
}
public function fetch_all_invalidate($start, $limit) {
return DB::fetch_all('SELECT mvi.field, v.message, v.submittimes, v.submitdate, v.moddate, v.admin, v.remark, v.uid as vuid
FROM '.DB::table('common_member_validate').' v
LEFT JOIN '.DB::table('common_member_verify_info').' mvi ON mvi.uid=v.uid AND mvi.verifytype=0
WHERE v.status=0 ORDER BY v.submitdate DESC '.DB::limit($start, $limit), '', 'vuid');
}
public function count_by_status($status) {
return DB::result_first('SELECT COUNT(*) FROM %t WHERE status=%d', array($this->_table, $status));
}
public function fetch_all_status_by_count() {
$count = array();
$query = DB::query("SELECT status, COUNT(*) AS count FROM ".DB::table('common_member_validate')." GROUP BY status");
while($num = DB::fetch($query)) {
$count[$num['status']] = $num['count'];
}
return $count;
}
public function fetch_all_by_status($status, $start = 0, $limit = 0) {
return DB::fetch_all('SELECT * FROM %t WHERE status=%d ORDER BY submitdate DESC'.DB::limit($start, $limit), array($this->_table, $status), $this->_pk);
}
}
?>