to be frank, I want to put firefox referral in my forum running on vBulletin. Is there any code which will help me to show it in all browsers except Firefox? any help will be appreciated. Thanks in advance.
Try one of my custom functions // Usage $browser = detect(); if ($browser != "FIREFOX") { // Show Firefox referral } function detect() { $browsers = array("IE","OPERA","MOZILLA","NETSCAPE","FIREFOX","SAFARI"); $browser = "OTHER"; foreach ($browsers as $parent) { $s = strpos(strtoupper($_SERVER['HTTP_USER_AGENT']), $parent); if ($s) $browser = $parent; } return $browser; } PHP:
There is a function for that in php get_browser() echo $_SERVER['HTTP_USER_AGENT'] . "\n\n"; $browser = get_browser(null, true); print_r($browser); PHP:
Yes... the error is in your code, not ours. You will have to post it. Actually... are you putting this code in your template? This won't work... if you're working with vBulletin, open for example global.php. and place this line somewhere, where it doesn't damage other code. $show['firefox_link'] = !preg_match('~Firefox~i', $_SERVER['HTTP_USER_AGENT']); PHP: And in your template: <if condition="$show[firefox_link']"> <!-- link here //--> </if> Code (markup):