function browse_infor()
{
$browser="";$browserver="";
//
$browsers =array("lynx","mosaic","aol","opera","java","macweb","webexplorer","omniweb");
$agent = $globals["http_user_agent"];
for ($i=0; $i<=7; $i++) //phpfensi.com
{
if (strpos($agent,$browsers[$i]))
{
$browser = $ブラウザ[$i];
$ブラウザサーバー ="";
}
}
if (ereg("mozilla",$agent) &&!ereg("msie",$agent)) //phpfensi.com
{
$temp =explode("(", $agent); $part=$temp[0];
$temp =explode("/", $part); $browserver=$temp[1];
$temp =explode(" ",$browserver); $browserver=$temp[0];
$browserver =preg_replace("/([d.]+)/","1",$browserver); = " $browserver"; //
$browser = "netscape navigator";
}
if (ereg("mozilla",$agent) && ereg("opera",$agent))
{
$temp =explode("(", $agent); $part=$temp[1];
//phpfensi.com
$temp =explode(")", $part); =$temp[1];
$temp =explode(" ",$browserver);$browserver=$temp[2];
//phpfensi.com
$browserver =preg_replace("/ ([d.]+)/","1",$browserver);
$browserver = " $browserver";
$browser = "opera";
}
if (ereg("mozilla", $agent) && ereg("msie",$agent))
//phpfensi.com
{
$temp = explode("(", $agent); $part=$temp[1 ];
$temp = explode(";",$part); $part=$temp[1]; //
$temp = explode(" ",$part);$browserver=$temp[2] ;
$browserver =preg_replace("/([d.]+)/","1",$browserver);
$browserver = " $browserver"; //
$browser = 「インターネット エクスプローラー」;
}
if ($browser!="")
{
$browseinfo = "$browser$browserver";
}
else
{
$browseinfo = "不明";
}
$browseinfo を返す;
}
//调用方法$browser=browseinfo() ; 直接返結果
?>
====
获取访问者操作系统
関数 osinfo() {
$os="";
$agent = $globals["http_user_agent"];
if (eregi('win',$agent) && strpos($agent, '95')) { //
$os="windows 95";
}
elseif (eregi('win 9x',$agent) && strpos($agent, '4.90')) {
$os="windows me";
}
elseif (eregi('win',$agent) && ereg('98',$agent)) {
//开源
$os="windows 98";
}
elseif (eregi('win',$agent) && eregi('nt 5.0',$agent)) {
$os="windows 2000";
}
elseif (eregi('win',$agent) && eregi('nt',$agent)) {
//开源
$os="windows nt";
}
elseif (eregi('win',$agent) && eregi('nt 5.1',$agent)) {
$os="windows xp";
}
elseif (eregi('win',$agent) && ereg('32',$agent)) {
//开源
$os="windows 32";
}
elseif (regi('linux',$agent)) {
$os="linux";
}
elseif (regi('unix',$agent)) {
$os="unix"; //php一聚设计
}
elseif (regi('sun',$agent) && regi('os',$agent)) {
$os="sunos";
}
elseif (regi('ibm',$agent) && regi('os',$agent)) { //
$os="ibm os/2";
}
elseif (regi('mac',$agent) && regi('pc',$agent)) {
$os="macintosh";
}
elseif (regi('powerpc',$agent)) { //
$os="powerpc";
}
elseif (regi('aix',$agent)) {
$os="aix";
}
elseif (regi('hpux',$agent)) {
$os="hpux";
//phpfensi.com
}
elseif (regi('netbsd',$agent)) {
$os="netbsd";
}
elseif (regi('bsd',$agent)) {
$os="bsd";
}
elseif (ereg('osf1',$agent)) {
//phpfensi.com
$os="osf1";
}
elseif (ereg('irix',$agent)) {
$os="irix";
}
elseif (regi('freebsd',$agent)) {
$os="freebsd";
//
}
if ($os=='') $os = "不明";
$os を返す;
}
// メソッド $os=os_infor() を呼び出します。
?>