PHP gets user browser and system functions

Source: Internet
Author: User
Tags linux
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;



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.