I checked out that page with
MSIE 6
Netscape7
Opera7
Mozilla 1.0.0
Right on the money every time.
I have a question for you.. How did you detect Opera 7?
This is what i'm doing. I've tried quite a few different ways, but no matter how I go about it, I can't seem to detect Opera 7!
<?php
$ip = getenv("REMOTE_ADDR"); // Getting the Internet Address
$usrcmp = getenv("HTTP_USER_AGENT"); // Getting misc. information
$referrer = getenv("HTTP_REFERER"); // Getting Referrer
// Getting Operating System Information - INCOMPLETE
// I know for a fact that Mac and Win XP work. The rest I dont know!
if(strstr($usrcmp, "Windows 95")) $OS= 'Windows 95';
else if(strstr($usrcmp, "Windows 98")) $OS = 'Windows 98';
else if(strstr($usrcmp, "Windows 2000")) $OS = 'Windows 2000';
else if(strstr($usrcmp, "Windows NT 5.1")) $OS = 'Windows XP';
// else if(strstr($usrcmp, "Windows XP")) $OS = 'Windows XP';
else if(strstr($usrcmp, "Windows ME")) $OS = 'Windows ME';
else if(strstr($usrcmp, "Windows NT")) $OS = 'Windows NT';
else if(strstr($usrcmp, "Mac")) $OS = 'Macintosh';
else if(strstr($usrcmp, "Linux")) $OS = 'Linux';
else if(strstr($usrcmp, "Unix")) $OS = 'Unix';
else if(strstr($usrcmp, "Solaris")) $OS = 'Solaris';
else if(strstr($usrcmp, "FreeBSD")) $OS = 'FreeBSD'; // :shrug: dunno if that works or not.
else $OS = '<b>Unavailable!</b>';
// Getting Browser - INCOMPLETE
if(strstr($comp, "MSIE 7")) $browser = 'IE 7';
else if(strstr($usrcmp, "MSIE 6")) $browser = 'Internet Explorer 6';
else if(strstr($usrcmp, "MSIE 5")) $browser = 'Internet Explorer 5';
else if(strstr($usrcmp, "MSIE 4")) $browser = 'Internet Explorer 4';
else if(strstr($usrcmp, "Netscape7")) $browser = 'Netscape 7';
else if(strstr($usrcmp, "Netscape6")) $browser = 'Netscape 6';
else if(strstr($usrcmp, "Netscape5")) $browser = 'Netscape 5';
// I'm not sure if the rest of these are accurate!
else if(strstr($usrcmp, "Opera7")) $browser = 'Opera 7'; // displays as IE5 for some reason. :KoRnfused:
else if(strstr($usrcmp, "Opera6")) $browser = 'Opera 6';
else if(strstr($usrcmp, "Opera5")) $browser = 'Opera 5';
else if(strstr($usrcmp, "Mozilla 1.0.0")) $browser = 'Mozilla 1.0.0';
else if(strstr($usrcmp, "Mozilla 1.0.1")) $browser = 'Mozilla 1.0.1';
else if(strstr($usrcmp, "Mozilla 1.0.2")) $browser = 'Mozilla 1.0.2';
else $browser = '<b>Unavailable</b>';
echo "Browser: $browser<br />\nOperating System: $OS<br />\n";
echo "IP: $ip<br />\n";
if (!$referrer) { echo "Direct Hit<br />\n"; }
else {
echo "$referrer<br />\n"; }
?>
I'm running Windows XP
Using the code above, I visited the page with
Opera 7 - which returns Internet Explorer 6. Anyone know why?
Also, it says OS is Unavailable!
Netscape 7 - Browser is Unavailable
OS - Windows XP
Same for Mozilla 1.0.0
Everything seemed to work fine when I visited with Internet Explorer 6.
Any suggestions / Fixes ?