Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: [Fixed]: ratepic.php possible bug?  (Read 14779 times)

0 Members and 1 Guest are viewing this topic.

Raven24

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 25
[Fixed]: ratepic.php possible bug?
« 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
« Last Edit: May 24, 2009, 12:42:47 pm by Joachim Müller »
Logged

Nibbler

  • Guest
Re: ratepic.php possible bug?
« Reply #1 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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: ratepic.php possible bug?
« Reply #2 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.