| Back to top |
Hi, thanks for the great browser detection php script. Small and quick =)
For file browser_detection_php_ar.txt, Line 350, Col 59. The bracket is placed wrong for the strstr call: this : if ( strstr( $browser_string, 'nt 5.1' || strstr( $browser_string, 'xp' )) )// windows xp should be: if ( strstr( $browser_string, 'nt 5.1') || strstr( $browser_string, 'xp' ) )// windows xp thanks again, -- Gabbo |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 770 Location: East Coast, West Coast? I know it's one of them. |
Gabboflabbo, thanks for catching that, that is now corrected, as of:
Version 4.2.8 That os version detector leaves something to be desired I have to say, it's the weakest part of the script, it works, but that's about it. Sorry about the size of the script, it's grown a bit large :) , but you can optimize its performance a bit by doing the following: :: Code ::
// call it in a function, but first create some static variables to hold //the full array contents, also whatever else you might need // repeatedly in your page function get_browser_info( $feature ) { static $a_browser_data, $browser, $browser_number, $os; // then load the include, pack the full information into the //static variable if ( !$a_browser_data ) { include_once('programs/browser_detection.inc'); $a_browser_data = browser_detection('full'); // pack the moz_version data into the static array // if it's a gecko browser, otherwise do nothing ( $a_browser_data[0] == 'moz' ) ? $a_browser_data[] = browser_detection('moz_version') : ''; $browser = $a_browser_data[0]; $browser_number = $a_browser_data[1]; $os = $a_browser_data[5]; } // then just return what you need by the $feature parameter, for // example if ($feature == 'full') { return $a_browser_data; } elseif ($feature == 'browser') { return $browser; } // and so on, that will save a bit of server load, especially on busy sites } This means that the include is called only once, and the browser detector runs only once, and all your browser data is available to you. However, the script is already optimized to only run through once, and packs the static variables in it, so unless speed is really important, the above process isn't actually necessary. |
|||||
| Back to top |
Hello colleagues! Great script. Your backlink as you wished to is placed here: englishextra.org.ua/index.php?page_id=about_webmaster
However, I encountered a problem with Linux OS. For intstance, this user-agent string doesn't get detected in terms of 'os' and 'os_version'. Please advise upon this matter. The string: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.8.1.8) Gecko/20071019 Fedora/2.0.0.8-1.fc7 Firefox/2.0.0.8 |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 770 Location: East Coast, West Coast? I know it's one of them. |
Seems to work fine. Running your user agent string, I get this using the 'your computer' feature:
:: Quote :: Your Computer
Operating System: Linux Distro: Fedora Current Browser / UA: Mozilla/ Firefox ProductSub: Not Available RV version: 1.8.1.8 XHTML support: Yes Note, I added fedora into the distro array, but it was working fine before too. The OS and distro come from os and os_version returns, so you must be doing something slightly off I think. |
|||||
| Back to top |
:: techAdmin wrote :: I added fedora into the distro array, but it was working fine before too. The OS and distro come from os and os_version returns, so you must be doing something slightly off I think.Oh yes. I added FEDORA too to the array I recieve Windows and its version OK. I get FREEBSD and LIBWWW-Perl and MAC successfully. What I wonder is that 'freebsd' is in the same array $a_os as 'fedora' (added by myself) to the $a_linux which is included into $a_os FREEBSD gets recognised FEDORA doesn't. And By the way, analysing server error_log I found out that this produces an error: :: Code :: $a_os = array( 'beos', 'os2', 'amiga', 'webtv', 'mac', 'nt', 'win', $a_unix, $a_linux );so I ended up with this: :: Code :: // only sometimes will you get a linux distro to id itself...
$a_linux = array( 'kanotix', 'ubuntu', 'mepis', 'debian', 'suse', 'redhat', 'slackware', 'mandrake', 'gentoo', 'linux', 'fedora' ); $a_linux_process = array ( 'i386', 'i586', 'i686' );// not use currently // note, order of os very important in os array, you will get failed ids if changed //$a_os = array( 'beos', 'os2', 'amiga', 'webtv', 'mac', 'nt', 'win', $a_unix, $a_linux ); $a_os = array( 'beos', 'os2', 'amiga', 'webtv', 'mac', 'nt', 'win', 'unixware', 'solaris', 'sunos', 'sun4', 'sun5', 'suni86', 'sun', 'freebsd', 'openbsd', 'bsd' , 'irix5', 'irix6', 'irix', 'hpux9', 'hpux10', 'hpux11', 'hpux', 'hp-ux', 'aix1', 'aix2', 'aix3', 'aix4', 'aix5', 'aix', 'sco', 'unixware', 'mpras', 'reliant', 'dec', 'sinix', 'unix', 'kanotix', 'ubuntu', 'mepis', 'debian', 'suse', 'redhat', 'slackware', 'mandrake', 'gentoo', 'linux', 'fedora');//shimansky family name comment means changes done by myself Thanks for your support You might use this test table: [link] (I used it to see what happens if I come from Win XP: browser moz number 1.8 type bro os nt os_number 5.1 and from fedora 7: browser moz number 1.8 type bro os os_number ) Here is the library I use with changes, that commented //shimansky [link] What I changed: Declared some variables (empty) preplaces array variables with array values for a_unix and a_linux cause this produced an error in server log |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 770 Location: East Coast, West Coast? I know it's one of them. |
you've made a mistake, but I can't support going through your changed code, only the original, which is working fine. You'll need to debug your mistakes yourself, I can't spend my time for you, sorry.
Freebsd should have been in the unix array, not the linux array. |
|||||
| Back to top |
All right sorry for bothering/ Can I place the oroginal code, see what happens with fedora detection and server logs and then come back to you with server error_log extracts?
|
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 770 Location: East Coast, West Coast? I know it's one of them. |
Just tested to confirm:
:: Quote :: Unix
Version: FREEBSD Current Browser / UA: Mozilla/ Firefox 2.0.0.11 ProductSub: 20071223 RV version: 1.8.1.11 XHTML support: Yes works fine in running script, here for example: [link] So you'll need to debug your stuff and figure out what you broke. There is however a small bug in the fedora detection, it fails to get the firefox version number, just the rv number, I'll have to take a look at that and see why. Version 4.9.14 has slightly updated os lists for linux, and cleaned up a bit those arrays. |
|||||
|
All times are GMT - 8 Hours
|
||||||
Contact Us
Hosting: Pair Networks: 0.110
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info
Hosting: Pair Networks: 0.110
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info