Rumah  >  Artikel  >  php教程  >  PHP-系统流量分析的程序

PHP-系统流量分析的程序

WBOY
WBOYasal
2016-06-21 09:12:22881semak imbas

程序|流量

>create table stream (
ip text,
sTime int,
visits int,
info text);

if($day$mlink=mysql_connect('localhost','ajax','xxxxxxx');
//统计至今首页被浏览的总次数
$query="select SUM(visits) as tvisits from stream";
$result=mysql_db_query('ajax',$query,$mlink);

echo '浏览首页总累积次数:';
if($row=mysql_fetch_object($result)){
echo $row->tvisits;
}

$week=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
for($i=0;$iecho '

';
$ctime1=time()-24*3600*$i;
$ctime2=time()-24*3600*($i-1);
echo '日期:'.date("m月d日",$ctime1).$week[date("w",$ctime1)];
echo "
";

$stoday1=mktime(0,0,0,date(m,$ctime1),date(d,$ctime1),date(Y,$ctime1));
$stoday2=mktime(0,0,0,date(m,$ctime2),date(d,$ctime2),date(Y,$ctime2));
//统计当日首页被浏览的累积次数
$query='select SUM(visits) as tvisits from stream where sTime>=';
$query.=$stoday1.' and sTime$result=mysql_db_query('ajax',$query,$mlink);
echo '浏览首页累积次数:';
if($row=mysql_fetch_object($result)){
echo $row->tvisits;
}
//统计当日拜访ip的数量
$query='select * from stream where sTime>='.$stoday1;
$query.=' and sTime$result=mysql_db_query('ajax',$query,$mlink);

echo "
浏览总人数:".mysql_num_rows($result);
echo '


';
echo '';
echo '


';
echo "";

while($row=mysql_fetch_object($result)){
echo '';
echo '';
echo '';
echo '';
echo '';
echo " ";
}
echo "
IP位址 最近时间 次数 用户资讯
'.$row->ip.''.date("h:i:sa",$row->sTime).''.$row->visits.''.$row->info.'
";
echo '
';
}
mysql_close($mlink);
?>



Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn