<?php
/*
+---------------------------------------------
*	访问量统计
+---------------------------------------------
*/
class L(){
	public $logDir;
	
	function __construct(){
		$this->logDir = root_path.'/log/date/'.WAPID.'/';
		if(!is_dir($this->logDir))
		{
			mkdir($this->logDir);
		}
	}
	
	public function setLog(){
		file_put_contents($this->logDir.time().'_'.$this->getIp(),time());
	}
	public function countLog(){
		$filename = $this->logDir;
		$arr = $dir -> listDir($filename,'NO');
		$Pv = count($arr);
	}
	public function getIp()
	{
		if ($_SERVER["HTTP_X_FORWARDED_FOR"]) { 
			$ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; 
		}elseif($_SERVER["HTTP_CLIENT_IP"]){ 
			$ip = $_SERVER["HTTP_CLIENT_IP"]; 
		}elseif($_SERVER["REMOTE_ADDR"]){ 
			$ip = $_SERVER["REMOTE_ADDR"]; 
		}elseif(getenv("HTTP_X_FORWARDED_FOR")){ 
			$ip = getenv("HTTP_X_FORWARDED_FOR"); 
		}elseif(getenv("HTTP_CLIENT_IP")){ 
			$ip = getenv("HTTP_CLIENT_IP"); 
		}elseif(getenv("REMOTE_ADDR")){ 
			$ip = getenv("REMOTE_ADDR"); 
		}else{ 
			$ip = "Unknown"; 
		} 
		return $ip;
	}
}