[Fixed]: ratepic.php possible bug? [Fixed]: ratepic.php possible bug?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Fixed]: ratepic.php possible bug?

Started by Raven24, September 06, 2007, 10:34:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Raven24

The code in the ratepic.php which determines the browser seems as if there was a little confusion.
$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.
$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

Nibbler

Recommend setting

$browser = $_SERVER["HTTP_USER_AGENT"];

As it was prior to revision 3157 and adding the new ones into 1.5

Thanks for the report.

Joachim Müller

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.