get ( 'Log_Path' ).DIRECTORY_SEPARATOR.$Y.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR; $list = scandir($dir); $thisList = array(); $name = 'Pass_log_'.date('Y_m_d',strtotime('-1 day today')); foreach($list as $data){ if(strpos($data, $name) !== false){ $thisList[$data] = $dir.$data; } } $allData = array(); $eventsArr = array(); $tmpEventsIp = array(); $tmpEventsUV = array(); foreach($thisList as $thisDir){ $string = file_get_contents($thisDir); $d = explode("\n", $string); foreach($d as $key=> $s){ if($s){ $arr = unserialize($s); if(isset($eventsArr[$arr['event_id']]['pv'])){ $eventsArr[$arr['event_id']]['pv'] ++; }else{ $eventsArr[$arr['event_id']]['pv'] = 1; } $tmpEventsIp[$arr['event_id']][$arr['ip']] = $arr['ip']; $tmpEventsUV[$arr['event_id']][$arr['ip'].$arr['user_agent']] = $arr['ip'].$arr['user_agent']; $allData[] = $arr; } } } # PV # IP foreach($tmpEventsIp as $events_id => $ips){ $eventsArr[$events_id]['ip'] = count($ips); } # UV foreach($tmpEventsUV as $events_id => $vps){ $eventsArr[$events_id]['uv'] = count($vps); } foreach($eventsArr as $events_id => $data){ $info = array(); $info ['events_id'] = $events_id ; $info ['pv_num'] = $data['pv'] ; $info ['uv_num'] = $data['uv'] ; $info ['ip_num'] = $data['ip'] ; $info ['date'] = strtotime('-1 day today'); $objDLotteryPvUvLog->add ( $info ,LotteryPvUvLog::PARAM_CREATE_ACTION_ONDUPLICATE); } } }