Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: [Fixed]: ratepic.php possible bug?  (Read 18763 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: 47843
  • 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.021 seconds with 18 queries.