用户IP、浏览器、操作系统
时间:2010-04-22 来源:xuequansongmo
<?php
$os=$_SERVER["HTTP_USER_AGENT"]; // 浏览者操作系统及浏览器
//分析浏览器
if(strpos($os,"NetCaptor")) $explorer="NetCaptor";
elseif(strpos($os,"Opera")) $explorer="Opera";
elseif(strpos($os,"Firefox")) $explorer="Firefox";
elseif(strpos($os,"MSIE 6")) $explorer="MSIE 6.x";
elseif(strpos($os,"MSIE 5")) $explorer="MSIE 5.x";
elseif(strpos($os,"MSIE 4")) $explorer="MSIE 4.x";
elseif(strpos($os,"Netscape")) $explorer="Netscape";
else $explorer="Other";
// 分析操作系统
if(strpos($os,"Windows NT 5.0")) $os="Windows 2000";
elseif(strpos($os,"Windows NT 5.1")) $os="Windows XP";
elseif(strpos($os,"Windows NT 5.2")) $os="Windows 2003";
elseif(strpos($os,"Windows NT")) $os="Windows NT";
elseif(strpos($os,"Windows 9")) $os="Windows 98";
elseif(strpos($os,"unix")) $os="Unix";
elseif(strpos($os,"linux")) $os="Linux";
elseif(strpos($os,"SunOS")) $os="SunOS";
elseif(strpos($os,"BSD")) $os="FreeBSD";
elseif(strpos($os,"Mac")) $os="Mac";
else $os="Other";
//ip
unset($ip);
if($_SERVER['HTTP_CLIENT_IP']){
$ip=$_SERVER['HTTP_CLIENT_IP'];
} else if($_SERVER['HTTP_X_FORWARDED_FOR']){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else{
$ip=$_SERVER['REMOTE_ADDR'];
}
//显示浏览者信息
echo "IP地址:".$ip."<br>";
echo "操作系统:".$os."<br>";
echo "浏览器:".$explorer."<br>";
?>
$os=$_SERVER["HTTP_USER_AGENT"]; // 浏览者操作系统及浏览器
//分析浏览器
if(strpos($os,"NetCaptor")) $explorer="NetCaptor";
elseif(strpos($os,"Opera")) $explorer="Opera";
elseif(strpos($os,"Firefox")) $explorer="Firefox";
elseif(strpos($os,"MSIE 6")) $explorer="MSIE 6.x";
elseif(strpos($os,"MSIE 5")) $explorer="MSIE 5.x";
elseif(strpos($os,"MSIE 4")) $explorer="MSIE 4.x";
elseif(strpos($os,"Netscape")) $explorer="Netscape";
else $explorer="Other";
// 分析操作系统
if(strpos($os,"Windows NT 5.0")) $os="Windows 2000";
elseif(strpos($os,"Windows NT 5.1")) $os="Windows XP";
elseif(strpos($os,"Windows NT 5.2")) $os="Windows 2003";
elseif(strpos($os,"Windows NT")) $os="Windows NT";
elseif(strpos($os,"Windows 9")) $os="Windows 98";
elseif(strpos($os,"unix")) $os="Unix";
elseif(strpos($os,"linux")) $os="Linux";
elseif(strpos($os,"SunOS")) $os="SunOS";
elseif(strpos($os,"BSD")) $os="FreeBSD";
elseif(strpos($os,"Mac")) $os="Mac";
else $os="Other";
//ip
unset($ip);
if($_SERVER['HTTP_CLIENT_IP']){
$ip=$_SERVER['HTTP_CLIENT_IP'];
} else if($_SERVER['HTTP_X_FORWARDED_FOR']){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else{
$ip=$_SERVER['REMOTE_ADDR'];
}
//显示浏览者信息
echo "IP地址:".$ip."<br>";
echo "操作系统:".$os."<br>";
echo "浏览器:".$explorer."<br>";
?>
相关阅读 更多 +