PHP gets user browser and system functions
Operating system function Useros () { $user _osagent = $_server[' http_user_agent ']; if (Strpos ($user _osagent, "NT 5.1")) { $visitor _os = "Windows XP (SP2)"; ElseIf (Strpos ($user _osagent, "NT 5.2") && Strpos ($user _osagent, "WOW64")) { $visitor _os = "Windows XP 64-bit Edition"; } elseif (Strpos ($user _osagent, "NT 5.2")) { $visitor _os = "Windows 2003"; } elseif (Strpos ($user _osagent, "NT 6.0")) { $visitor _os = "Windows Vista"; } elseif (Strpos ($user _osagent, "NT 5.0")) { $visitor _os = "Windows 2000"; } elseif (Strpos ($user _osagent, "4.9")) { $visitor _os = "Windows ME"; } elseif (Strpos ($user _osagent, "NT 4")) { $visitor _os = "Windows NT 4.0"; } elseif (Strpos ($user _osagent, "98")) { $visitor _os = "Windows 98"; } elseif (Strpos ($user _osagent, "95")) { $visitor _os = "Windows 95"; } elseif (Strpos ($user _osagent, "Mac")) { $visitor _os = "Mac"; } elseif (Strpos ($user _osagent, "Linux")) { $visitor _os = "Linux"; } elseif (Strpos ($user _osagent, "Unix")) { $visitor _os = "Unix"; } elseif (Strpos ($user _osagent, "FreeBSD")) { $visitor _os = "FreeBSD"; } elseif (Strpos ($user _osagent, "SunOS")) { $visitor _os = "SunOS"; } elseif (Strpos ($user _osagent, "BeOS")) { $visitor _os = "BeOS"; } elseif (Strpos ($user _osagent, "OS/2")) { $visitor _os = "OS/2"; } elseif (Strpos ($user _osagent, "PC")) { $visitor _os = "Macintosh"; } elseif (Strpos ($user _osagent, "AIX")) { $visitor _os = "AIX"; } elseif (Strpos ($user _osagent, "IBM os/2")) { $visitor _os = "IBM os/2"; } elseif (Strpos ($user _osagent, "BSD")) { $visitor _os = "BSD"; } elseif (Strpos ($user _osagent, "NetBSD")) { $visitor _os = "NetBSD"; } else { $visitor _os = "other"; } return $visitor _os; }
|
Browser settings function Userbrowser () { $user _osagent = $_server[' http_user_agent ']; if (Strpos ($user _osagent, "Maxthon") && Strpos ($user _osagent, "MSIE")) { $visitor _browser = "Maxthon (Microsoft IE)"; }elseif (Strpos ($user _osagent, "Maxthon 2.0")) { $visitor _browser = "Maxthon 2.0"; }elseif (Strpos ($user _osagent, "Maxthon")) { $visitor _browser = "Maxthon"; }elseif (Strpos ($user _osagent, "MSIE 7.0")) { $visitor _browser = "MSIE 7.0"; }elseif (Strpos ($user _osagent, "MSIE 6.0")) { $visitor _browser = "MSIE 6.0"; } elseif (Strpos ($user _osagent, "MSIE 5.5")) { $visitor _browser = "MSIE 5.5"; } elseif (Strpos ($user _osagent, "MSIE 5.0")) { $visitor _browser = "MSIE 5.0"; } elseif (Strpos ($user _osagent, "MSIE 4.01")) { $visitor _browser = "MSIE 4.01"; } elseif (Strpos ($user _osagent, "Netcaptor")) { $visitor _browser = "Netcaptor"; } elseif (Strpos ($user _osagent, "Netscape")) { $visitor _browser = "Netscape"; } elseif (Strpos ($user _osagent, "Lynx")) { $visitor _browser = "Lynx"; } elseif (Strpos ($user _osagent, "Opera")) { $visitor _browser = "Opera"; } elseif (Strpos ($user _osagent, "Konqueror")) { $visitor _browser = "Konqueror"; } elseif (Strpos ($user _osagent, "mozilla/5.0")) { $visitor _browser = "Mozilla"; } elseif (Strpos ($user _osagent, "U")) { $visitor _browser = "Firefox"; } else { $visitor _browser = "other"; } return $visitor _browser; } |
$out _ieos = "Your operating system and browser information:". Useros (). ". Userbrowser (); echo $out _ieos; |