update
This commit is contained in:
parent
1d1018abf4
commit
7f2b29e112
1 changed files with 14 additions and 10 deletions
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
$g5['clap_table'] = G5_TABLE_PREFIX . 'clap';
|
||||
|
||||
// 랜덤 테이블이 없을 경우 생성
|
||||
if (!sql_table_exists($g5['clap_table'])) {
|
||||
// database table check only admin (request reduce)
|
||||
if ($is_admin) {
|
||||
if (!sql_table_exists($g5['clap_table'])) {
|
||||
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['clap_table']}` (
|
||||
`cl_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`cl_ip` varchar(255) NOT NULL default '',
|
||||
|
|
@ -11,9 +12,11 @@ if (!sql_table_exists($g5['clap_table'])) {
|
|||
`cl_val` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`cl_id`)
|
||||
) ENGINE = MyISAM DEFAULT CHARSET=utf8;", false);
|
||||
}
|
||||
}
|
||||
|
||||
$last = date("Y-m-d", strtotime("today -30 day"));
|
||||
|
||||
$be = sql_fetch("SELECT cl_id,cl_date FROM {$g5['clap_table']} WHERE cl_cnt > 1 AND date_format(cl_date, '%Y-%m-%d') <= '{$last}' ORDER BY cl_date LIMIT 1");
|
||||
|
||||
if ($be['cl_id']) {
|
||||
|
|
@ -21,6 +24,7 @@ if ($be['cl_id']) {
|
|||
}
|
||||
|
||||
$sum = sql_fetch("SELECT sum(cl_cnt) as sum FROM {$g5['clap_table']} WHERE date_format(cl_date, '%Y-%m-%d') <= '{$last}'");
|
||||
|
||||
if ($sum['sum']) {
|
||||
$cnt = $sum['sum'];
|
||||
sql_query("DELETE FROM {$g5['clap_table']} WHERE date_format(cl_date, '%Y-%m-%d') <= '{$last}'");
|
||||
|
|
|
|||
Loading…
Reference in a new issue