1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
//获取用户操作系统信息 function getSystem(){ $sys = $_SERVER[‘HTTP_USER_AGENT’]; if(stripos($sys, “NT 6.1”)) $os = “Windows 7”; elseif(stripos($sys, “NT 6.0”)) $os = “Windows Vista”; elseif(stripos($sys, “NT 5.1”)) $os = “Windows XP”; elseif(stripos($sys, “NT 5.2”)) $os = “Windows Server 2003”; elseif(stripos($sys, “NT 5”)) $os = “Windows 2000”; elseif(stripos($sys, “NT 4.9”)) $os = “Windows ME”; elseif(stripos($sys, “NT 4”)) $os = “Windows NT 4.0”; elseif(stripos($sys, “98”)) $os = “Windows 98”; elseif(stripos($sys, “95”)) $os = “Windows 95”; elseif(stripos($sys, “Mac”)) $os = “Mac”; elseif(stripos($sys, “Linux”)) $os = “Linux”; elseif(stripos($sys, “Unix”)) $os = “Unix”; elseif(stripos($sys, “FreeBSD”)) $os = “FreeBSD”; elseif(stripos($sys, “BeOS”)) $os = “BeOS”; elseif(stripos($sys, “Windows NT 6.3”)) $os = “Windwos 8.1”; else $os = “未知操作系统”; return $os; } $system = getSystem();
获取系统这里添加了获取windows 8 的判断。
//获取地区信息 function getAdress($a){ $url = “http://ip.chinaz.com/?IP=”.$a; $fp = @fopen($url, “r”) or die(“超时”); $fcontents = file_get_contents($url); preg_match_all(“/==>> d+ ==>> (.*)< strong=""> /”, $fcontents, $regs); return $regs[1][0]; } $adress = getAdress($ip);
|