日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql php页面流量统计_PHP学习笔记:php网络流量统计系统

發布時間:2025/3/15 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql php页面流量统计_PHP学习笔记:php网络流量统计系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

date_default_timezone_set('Asia/Chongqing'); //系統時間差8小時問題

$cur_time = getdate();return $cur_time['year'] . "-" . $cur_time['mon'] . "-" . $cur_time['mday'] . " " . $cur_time['hours'] . ":" . $cur_time['minutes'] . ":" . $cur_time['seconds'];//程序調用getdate()函數獲取當前系統時間,結果保存在$cur_time數組中,然后將$cur_time數組中的元素構建成指定格式的字符串,作為函數的返回值

}/*function GetExplore() {

//返回客戶端用戶使用的瀏覽器

$explore = "";

$Agent = $_SERVER["HTTP_USER_AGENT"];

//echo($Agent);

//使用$_SERVER["HTTP_USER_AGENT"]返回訪問當前網頁的客戶端信息。

//例如:win7,IE9.0 ————> Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

// 找到第1個;的位置

$pos = strpos($Agent, ';');

if($pos < 0)

return "";

$explore = substr($Agent, $pos+1, strlen($Agent)-$pos); // 截取第1個分號后面的字符串

// 找到第2個;的位置

$pos = strpos($explore, ';');

// 第1個分號和第2個分號之間是瀏覽器信息

$explore = substr($explore, 0, $pos);

return $explore;

}

//書中所給的代碼有誤,就是判斷瀏覽器出錯,因為在谷歌中$Agent = $_SERVER["HTTP_USER_AGENT"];返回的是Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36*/

/*IE mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0)

360 mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0; 360se)

搜狗 mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; trident/4.0; se 2.x metasr 1.0)

世界之窗 mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; trident/4.0)

遨游 mozilla/5.0 (windows nt 5.1) applewebkit/535.12 (khtml, like gecko) maxthon/3.3.4.4000 chrome/18.0.966.0 safari/535.12

火狐 mozilla/5.0 (windows nt 5.1; rv:8.0.1) gecko/20100101 firefox/8.0.1

谷歌 mozilla/5.0 (windows nt 5.1) applewebkit/535.11 (khtml, like gecko) chrome/17.0.963.26 safari/535.11

opera opera/9.80 (windows nt 5.1; u; edition next; zh-cn) presto/2.10.255 version/12.00*/

//通過修改過的,其他幾個就先不試了,具體的其他瀏覽器返回信息在上面

functionGetExplore() {$Agent = $_SERVER["HTTP_USER_AGENT"];$browseragent=""; //瀏覽器

$browserversion=""; //瀏覽器的版本

if (preg_match('/MSIE ([0-9].[0-9]{1,2})/i',$Agent,$version)) {$browserversion=$version[1];$browseragent="Internet Explorer";

}else if (preg_match( '/Opera\/([0-9]{1,2}.[0-9]{1,2})/i',$Agent,$version)) {$browserversion=$version[1];$browseragent="Opera";

}else if (preg_match( '/Firefox\/([0-9.]{1,5})/i',$Agent,$version)) {$browserversion=$version[1];$browseragent="Firefox";

}else if (preg_match( '/Chrome\/([0-9.]{1,3})/i',$Agent,$version)) {$browserversion=$version[1];$browseragent="Chrome";

}else if (preg_match( '/Safari\/([0-9.]{1,3})/i',$Agent,$version)) {$browseragent="Safari";$browserversion="";

}else{$browserversion="";$browseragent="Unknown";

}return $browseragent." ".$browserversion;

}functionGetOSInfo() {//在獲取客戶端的瀏覽器信息時,包含操作系統信息

$os="";$Agent = $_SERVER["HTTP_USER_AGENT"];if (preg_match('/win/i',$Agent) && strpos($Agent, '95')) {$os="Windows 95";

}elseif (preg_match('/win 9x/i',$Agent) && strpos($Agent, '4.90')) {$os="Windows ME";

}elseif (preg_match('/win/i',$Agent) && ereg('98',$Agent)) {$os="Windows 98";

}elseif (preg_match('/win/i',$Agent) && preg_match('/nt 5\.0/i',$Agent)) {$os="Windows 2000";

}elseif (preg_match('/win/i',$Agent) && preg_match('/nt 5\.2/i',$Agent)) {$os="Windows 2003";

}elseif (preg_match('/win/i',$Agent) && preg_match('/nt 5\.1/i',$Agent)) {$os="Windows XP";

}elseif (preg_match('/win/i',$Agent) && preg_match('/nt 6\.1/i',$Agent)) {$os="Windows 7";

}elseif (preg_match('/win/i',$Agent) && preg_match('/32/i',$Agent)) {$os="Windows 32";

}elseif (preg_match('/win/i',$Agent) && preg_match('/nt/i',$Agent)) {$os="Windows NT";

}elseif (preg_match('/linux/i',$Agent)) {$os="Linux";

}elseif (preg_match('/unix/i',$Agent)) {$os="Unix";

}elseif (preg_match('/sun/i',$Agent) && preg_match('/os/',$Agent)) {$os="SunOS";

}elseif (preg_match('/ibm/i',$Agent) && preg_match('/os/',$Agent)) {$os="IBM OS/2";

}elseif (preg_match('/Mac/',$Agent) && preg_match('/PC/',$Agent)) {$os="Macintosh";

}elseif (preg_match('/PowerPC/i',$Agent)) {$os="PowerPC";

}elseif (preg_match('/AIX/',$Agent)) {$os="AIX";

}elseif (preg_match('/HPUX/',$Agent)) {$os="HPUX";

}elseif (preg_match('/NetBSD/',$Agent)) {$os="NetBSD";

}elseif (preg_match('/BSD/',$Agent)) {$os="BSD";

}elseif (ereg('OSF1',$Agent)) {$os="OSF1";

}elseif (ereg('IRIX',$Agent)) {$os="IRIX";

}elseif (preg_match('/FreeBSD/',$Agent)) {$os="FreeBSD";

}if ($os=='')$os = "Unknown";return $os;//eregi()函數用于實現不區分大小寫的正則表達式匹配,語法為 int eregi(string $pattern,string $string,[,array $regs])

//只是在php5.3之后不再支持eregi(), 了改為preg_match()

}?>

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的mysql php页面流量统计_PHP学习笔记:php网络流量统计系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。