예제 #1
0
                foreach ($clicksarr as $id => $clicks) {
                    if ($clicks && ($id = intval($id))) {
                        $db->query("UPDATE {$tblprefix}archives SET clicks=clicks+{$clicks} WHERE aid={$id}", 'UNBUFFERED');
                        updaterecent($id, 'clicks', $clicks);
                    }
                }
            }
        }
        if (@($fp = fopen($cachefile, 'a'))) {
            fwrite($fp, "{$aid}\n");
            fclose($fp);
        }
    } else {
        $db->query("UPDATE {$tblprefix}archives SET clicks=clicks+1 WHERE aid='{$aid}'", 'UNBUFFERED');
        recent2main();
        updaterecent($aid, 'clicks', 1);
    }
}
if (!empty($mid)) {
    if ($clickscachetime) {
        $cachefile = M_ROOT . './dynamic/stats/msclicks.cac';
        $cachetimefile = M_ROOT . './dynamic/stats/msclicks_time.cac';
        if ($timestamp - @filemtime($cachetimefile) > $clickscachetime) {
            if ($clicksarr = @file($cachefile)) {
                if (@($fp = fopen($cachefile, 'w'))) {
                    fclose($fp);
                }
                //清空内容
                if (@($fp = fopen($cachetimefile, 'w'))) {
                    fclose($fp);
                }
예제 #2
0
 function arc_nums($dname, $add = 1, $updatedb = 0)
 {
     $this->basic_data();
     if (in_array($dname, array('orders', 'ordersum', 'comments', 'answers', 'adopts', 'favorites', 'praises', 'debases', 'scores', 'downs', 'plays', 'offers', 'replys', 'reports'))) {
         $this->updatefield($dname, max(0, $this->archive[$dname] + $add), in_array($dname, array('reports')) ? 'sub' : 'main');
         updaterecent($this->aid, $dname, $add);
     }
     $updatedb && $this->updatedb();
 }