首頁  >  文章  >  後端開發  >  PHP系統流量分析的程式_PHP教程

PHP系統流量分析的程式_PHP教程

WBOY
WBOY原創
2016-07-21 16:07:13911瀏覽

>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 ''.$row->info.'';
echo " ";
}
echo "
IP地址 最近時間 次數 td>
用戶資訊
'.$row->ip.''.date("h :i:sa",$row->sTime).''.$row->visits.'
";
echo '';
}
mysql_close($mlink);
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315149.htmlTechArticlecreate table stream ( ip text, sTime int, visits int, info text); ? if($day0) ? day=0; $mlink=mysql_connect('localhost','ajax','xxxxxxx'); //統計至今首頁被瀏覽的總次數$q...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn