⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 在传统CMS文章内容管理功能基础上
💻 PHP
字号:
<?PHP/*    [BBWPS!] (C)2006-2010 小蜜蜂版权所有.	  This is NOT a freeware, use is subject to license terms*///全站访问统计error_reporting(0);if(!function_exists("CheckRequire")){	exit("Forbidden");}$p=new Template("./template/stat");///////////////////////////////////////////////自定义面额/////////////////////////////////////////////if($_GET['act']=="edit"){	$confStr = '<?PHP'."\n";	foreach ($_POST["stat"] as $key=>$value){		$confStr.='$statPara['.$key.']='.intval($value).';'."\n";	}	$confStr.='extract($statPara);'."\n";	$confStr.='?>';	$fp=fopen("../data/statconf.php","w");	if(fwrite($fp,$confStr,strlen($confStr))){		flock($fp,1);		fclose($fp);		ExeSuccess($langAdminArray["bank_succ"],"?mod=stat&f=conf");	}	flock($fp,1);	fclose($fp);	unset($_POST,$action,$confStr,$fp);}else{	//没有参数	if(!$_GET["year"]){		$year=date("Y");		$_GET["month"]?$month=$_GET["month"]:$month=intval(date("m"));		$_GET["day"]?$day=$_GET["day"]:$day=intval(date("d"));	}	else{		$year=$_GET["year"];		if($_GET["month"]){			$month=$_GET["month"];			if($_GET["day"]){				$day=$_GET["day"];			}			else{				$day=1;			}		}		else{			$month=1;			$day=1;		}	}	$p->set_file("handle1","index.html");	$p->set_block("handle1","yearshow","yea");	$p->set_block("handle1","monthshow","mon");	$p->set_block("handle1","searchengin","sere");	$p->set_block("handle1","referertop","ref");	$p->set_block("handle1","viewtop","vie");	//显示年和月列表	$ipArray=unserialize(file_get_contents("../log/pv.log"));	//循环年	foreach ($ipArray as $yeark=>$v){		$p->set_var("year",$yeark);		$p->parse("yea","yearshow",true);		foreach ($v as $monthk=>$vm){			if($year==$yeark){				$p->set_var("month",$monthk);				$p->parse("mon","monthshow",true);			}			foreach ($vm as $dayk=>$vd){				if($month==$monthk) $monthPV+=$vd;				if($year==$yeark)   $yearPV+=$vd;				if($day==$dayk) $dayPv+=$vd;				$allPv+=$vd;			}		}	}	$p->set_var("pv3",intval($yearPV));	$p->set_var("pv2",intval($monthPV));	$p->set_var("pv1",intval($dayPv));	$calender=wrCalendar("?mod=stat&f=index",$day,$month,$year);	$p->set_var("year",$year);	$p->set_var("month",$month);	$p->set_var("day",$day);	$p->set_var("calender",$calender);	//分析当天的日志	$month<10?$month="0".$month:null;	$day<10?$day="0".$day:null;	if(file_exists("../log/{$year}{$month}{$day}.log")){		$fp=fopen("../log/{$year}{$month}{$day}.log","r");		include_once("../data/statconf.php");		$searchEngin=explode(" ",$search);		$searchStatIP=array();		$searchStatPV=array();		$viewSat=array();		while (!feof($fp)){			$strLine=fgets($fp,1024);			if(strlen($strLine)>10){				$strArray=explode("|",$strLine);				//页面访问统计				$viewSat[$strArray[5]]+=1;				if($strArray[3]){					$searchFlag=0;					foreach ($searchEngin as $value){						$URLArray=parse_url($strArray[3]);						if(strstr($URLArray["host"],$value)){							$searchStatPV[$value]+=1;							if(count($strArray)==8){								$searchStatIP[$value]+=1;							}							$searchFlag=1;							break;						}					}					if(!$searchFlag){						$searchStatPV[$strArray[3]]+=1;						if(count($strArray)==8){							$searchStatIP[$strArray[3]]+=1;						}					}				}				else{					if(count($strArray)==8){						$searchStatIP["localhost"]+=1;					}					$searchStatPV["localhost"]+=1;				}			}		}		arsort($searchStatIP);		arsort($searchStatPV);		arsort($viewSat);		foreach ($searchEngin as $searchname){			if(isset($searchStatPV[$searchname])){				$ip=$searchStatPV[$searchname];			}			else{				$ip=0;			}			if(isset($searchStatPV[$searchname])){				$pv=$searchStatPV[$searchname];			}			else{				$pv=0;			}			$p->set_var("searchname",$searchname);			$p->set_var("ip",$ip);			$p->set_var("pv",$pv);			$p->parse("sere","searchengin",true);		}		foreach ($searchStatIP as $url=>$value){			if($i>10) break;			if($url!=="localhost"){				$p->set_var("url",$url);				$p->parse("ref","referertop",true);				$i++;			}		}		$i=0;		foreach ($viewSat as $url=>$value){			if($i>10) break;			$p->set_var("url",$url);			$p->set_var("hits",$value);			$p->parse("vie","viewtop",true);			$i++;		}	}	$p->parse("out","handle1",true);	$p->p("out");}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -