示例#1
0
 static function hitscounter($id, $title, $url)
 {
     $timeout = self::$_timeout;
     $requestime = $_SERVER['REQUEST_TIME'];
     $cookiename = strtoupper(md5($title));
     if (empty($_COOKIE[$cookiename])) {
         setcookie($cookiename, $requestime);
     } else {
         if ($_COOKIE[$cookiename] + $timeout > $requestime) {
             return false;
         }
     }
     $addate = COMCommon::sysTime();
     $stat = new Traffic_statistics();
     $one = $stat->getOne("box_id=? and title=?", array($id, $title));
     if ($one) {
         $one->hitscount = $one->hitscount + 1;
         $one->status = 1;
         $flag = $one->save();
     } else {
         $flag = $stat->add($id, $title, $url, 1, 1, $addate);
     }
     return $flag;
 }