birdie Posted August 10, 2006 Share Posted August 10, 2006 Hi, i know $_SERVER['http_user_agent'] provides 'browser' detection but it just doesnt work simply.Is there any way you can basically but this variable or another 1 which can do a relatively similiar action.Example of the script[code]$browser = $_SERVER['http_user_agent'];if(eregi('Firefox', $browser)){$sql = "UPDATE sitestats_browser SET firefox='$firefox'";}elseif(eregi('MSIE', $browser)){$sql = "UPDATE sitestats_browser SET ie='$internetexplorer'";}else{$sql = "UPDATE sitestats_browser SET other='$other'";}[/code]Well this doesnt work because there are different versions of firefox.Any help please? Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 10, 2006 Share Posted August 10, 2006 Try the get_browser() function: [url=http://www.phpfreaks.com/phpmanual/page/function.get-browser.html]http://www.phpfreaks.com/phpmanual/page/function.get-browser.html[/url] Quote Link to comment Share on other sites More sharing options...
rab Posted August 10, 2006 Share Posted August 10, 2006 [url=http://www.zytrax.com/tech/web/browser_ids.htm]http://www.zytrax.com/tech/web/browser_ids.htm[/url]Have a look at the UA strings Quote Link to comment Share on other sites More sharing options...
corbin Posted August 10, 2006 Share Posted August 10, 2006 [code=php:0]<?$b = $_SERVER['HTTP_USER_AGENT'];if(eregi('firefox', $b)) {echo "got firefox";}elseif(eregi('MSIE', $b)) {echo "got IE";}else { echo "Got other"; }?>[/code]Just tried that real quick... It works fine... ( http://corbin-dev.no-ip.org/browser.php ) Quote Link to comment Share on other sites More sharing options...
birdie Posted August 10, 2006 Author Share Posted August 10, 2006 wow thanks for the quick posts, i'll try them all out :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.