0
I am setting up a support system and need to get some customer data when it opens the service these data are: IP Operating system in this format ( Windows 10 64x e.g.) Browser used ( Google Chrome Versao 99 )
ip I can pick up normally. what is missing is the rest and the closest I got was this here;
$ip = $_SERVER['REMOTE_ADDR'];
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
if (preg_match('/linux/i', $u_agent)) {
$platform = 'Linux';
}
elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
$platform = 'Mac';
}
elseif (preg_match('/windows|win32/i', $u_agent)) {
$platform = 'Windows';
}
if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
{
$bname = 'Internet Explorer';
$ub = "MSIE";
}
elseif(preg_match('/Firefox/i',$u_agent))
{
$bname = 'Mozilla Firefox';
$ub = "Firefox";
}
elseif(preg_match('/Chrome/i',$u_agent))
{
$bname = 'Google Chrome';
$ub = "Chrome";
}
elseif(preg_match('/AppleWebKit/i',$u_agent))
{
$bname = 'AppleWebKit';
$ub = "Opera";
}
elseif(preg_match('/Safari/i',$u_agent))
{
$bname = 'Apple Safari';
$ub = "Safari";
}
elseif(preg_match('/Netscape/i',$u_agent))
{
$bname = 'Netscape';
$ub = "Netscape";
}
$known = array('Version', $ub, 'other');
$pattern = '#(?<browser>' . join('|', $known) .')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
if (!preg_match_all($pattern, $u_agent, $matches)) {
}
$i = count($matches['browser']);
if ($i != 1) {
if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
$version= $matches['version'][0];
}
else {
$version= $matches['version'][1];
}
}
else {
$version= $matches['version'][0];
}
// check if we have a number
if ($version==null || $version=="") {$version="?";}
$Browser = array(
'userAgent' => $u_agent,
'name' => $bname,
'version' => $version,
'platform' => $platform,
'pattern' => $pattern
);
$navegador = "Navegador: " . $Browser['name'] . " " . $Browser['version'];
$so = "SO: " . $Browser['platform'];
echo $navegador . "<br> $so";
and this returns
Browser: Google Chrome 60.0.3112.90 OS: Windows
so just missing bring what windows system is in case if it is windows or which linux or other operating system it is and if available whether it is 32 or 64x
someone could guide me with changing this function to display at least the version of OS?
Related https://answall.com/questions/227228/como-pega-informa%C3%A7%C3%B5es-do-sistema-operacional-do-cliente/227235#227235
– MagicHat
What exit would you like?
– MagicHat
only thing missing is which version of windows by ex windows 10 or 8.1 or if it is mac or liux which version is by ex Centos 7 or Snow Leopard and etc
– Jasar Orion
@Magichat is not duplicate?
– Woss