Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Raven24 on September 06, 2007, 10:34:34 pm

Title: [Fixed]: ratepic.php possible bug?
Post by: Raven24 on September 06, 2007, 10:34:34 pm
The code in the ratepic.php which determines the browser seems as if there was a little confusion.
Code: [Select]
$browser = 'Unknown';
if(eregi("MSIE",$browser)) {
    if(eregi("MSIE 5.5",$browser)) {
        $browser = "Microsoft Internet Explorer 5.5";
    } else if(eregi("MSIE 6.0",$browser)) {
        $browser = "Microsoft Internet Explorer 6.0";
} else if(eregi("Mozilla Firebird",$browser)) {
    $browser = "Mozilla Firebird";
} else if(eregi("netscape",$browser)) {
    $browser = "Netscape";
Because if $browser was set to "Unknown" at the beginning you can't look for much more strings in it. (Which means the browser is always "Unknown")
I fixed the "little problem" and also added a few more browsers and OSs.
Code: [Select]
$os = "Unknown";
if(eregi("Linux",$_SERVER["HTTP_USER_AGENT"])) $os = "Linux";
else if(eregi("Windows NT 5.0",$_SERVER["HTTP_USER_AGENT"])) $os = "Windows 2000";
else if(eregi("Windows NT 5.1|Windows NT 5.2",$_SERVER["HTTP_USER_AGENT"])) $os = "Windows XP";
else if(eregi("Windows NT 6.0",$_SERVER["HTTP_USER_AGENT"])) $os = "Windows Vista";
else if(eregi("win98|Windows 98",$_SERVER["HTTP_USER_AGENT"])) $os = "Windows 98";

$browser = 'Unknown';
if(eregi("MSIE",$_SERVER["HTTP_USER_AGENT"])) {
if(eregi("MSIE 5.5",$_SERVER["HTTP_USER_AGENT"])) $browser = "Microsoft Internet Explorer 5.5";
else if(eregi("MSIE 6.0",$_SERVER["HTTP_USER_AGENT"])) $browser = "Microsoft Internet Explorer 6.0";
else if(eregi("MSIE 7.0",$_SERVER["HTTP_USER_AGENT"])) $browser = "Microsoft Internet Explorer 7.0";
else if(eregi("Mozilla Firebird",$_SERVER["HTTP_USER_AGENT"])) $browser = "Mozilla Firebird";
else if(eregi("Netscape",$_SERVER["HTTP_USER_AGENT"])) $browser = "Netscape";
//else if(eregi("Gecko" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'Mozilla';
else if(eregi("Firefox" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'Mozilla Firefox';
else if(eregi("Netscape" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'Netscape';
else if(eregi("Opera" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'Opera';
else if(eregi("AppleWebKit" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'AppleWebKit';
else if(eregi("KHTML" , $_SERVER["HTTP_USER_AGENT"])) $browser = 'Konqueror';

hope that was helpful
Title: Re: ratepic.php possible bug?
Post by: Nibbler on September 06, 2007, 10:53:40 pm
Recommend setting

Code: [Select]
$browser = $_SERVER["HTTP_USER_AGENT"];
As it was prior to revision 3157 and adding the new ones into 1.5

Thanks for the report.
Title: Re: ratepic.php possible bug?
Post by: Joachim Müller on May 24, 2009, 12:42:33 pm
Backported browser and client OS detection function from cpg1.5.x for granular stats, as the code in cpg1.4.x was redundant, buggy and in no way matched modern browser standards. Change will be in cpg1.4.24.