<?php
if (!defined('R_P')) exit("access Die");
@set_time_limit(180);
@ignore_user_abort();
$temp = qdb::fetchAll("select id, channelid, auto_update, last_autodate from ".TABLEPRE."collect_rule ");
$data = array();
$c = 0;
$ids = array();
foreach($temp as $val){
	if($_SERVER['REQUEST_TIME'] - $val['last_autodate'] < 1800 || empty($val['auto_update'])) continue;
	eval("\$c=" . str_replace("@", qbase::formatTime('h', time()), $val['auto_update']) .";");
	if($c == 0) $data[] = $val;
	$ids[] = $val['id'];
}
if(!empty($ids)){
	qdb::query("updae ".TABLEPRE."collect_rule set last_autodate = '{$_SERVER['REQUEST_TIME']}' where id IN (". implode(',', $ids) .") ");
}
echo qbase::xmlprint(qbase::jsonencode($data));
?>