restrict certain browser from browsing your site

hello every body ..
so today i have made this little modification to restrict certain  browser from browsing your site .. lets say you have a compatibility issue with a certain  browser and your not willing to solve it ... or you don't want ppl using i phone to open your site using safari .. and so on

all you have to do is download the file i have attached
and then upload it in the "inc" directory
and then open header.inc.php
now after the "<?" tag add
require_once('restricted.php');

and then search for $aErrors = array();
and then add after it (in a new line would be better)


// this part is to restrict browsers

    $browser = new Browser();
    if(  ( $browser->getBrowser() == Browser::BROWSER_CHROME && $browser->getVersion() >= 2 ) ) {
$aErrors[] = "to use this web site you have to use IE or FIREFOX";   }

finally search for {$sErrors}
and delete the following
<br />
Please go to the <br />
<a href="http://www.boonex.com/trac/dolphin/wiki/GenDolTShooter">Dolphin Troubleshooter</a> <br />
and solve the problem.

and your done ( dont forget to save your work ;) )

in the example above i have restricted google chrome you can change BROWSER_CHROME with any thing you would like to from the following list.

        BROWSER_UNKNOWN = unknown
        VERSION_UNKNOWN = unknown
        BROWSER_OPERA = Opera
        BROWSER_OPERA_MINI = Opera Mini
        BROWSER_WEBTV = WebTV
        BROWSER_IE = Internet Explorer
        BROWSER_POCKET_IE = Pocket Internet Explorer
        BROWSER_KONQUEROR = Konqueror
        BROWSER_ICAB = iCab
        BROWSER_OMNIWEB = OmniWeb
        BROWSER_FIREBIRD = Firebird
        BROWSER_FIREFOX = Firefox
        BROWSER_ICEWEASEL = Iceweasel
        BROWSER_SHIRETOKO = Shiretoko
        BROWSER_MOZILLA = Mozilla
        BROWSER_AMAYA = Amaya
        BROWSER_LYNX = Lynx
        BROWSER_SAFARI = Safari
        BROWSER_IPHONE = iPhone
        BROWSER_IPOD = iPod
        BROWSER_IPAD = iPad
        BROWSER_CHROME = Chrome
        BROWSER_ANDROID = Android
        BROWSER_GOOGLEBOT = GoogleBot
        BROWSER_SLURP = Yahoo! Slurp
        BROWSER_W3CVALIDATOR = W3C Validator
        BROWSER_BLACKBERRY = BlackBerry
        BROWSER_ICECAT = IceCat
        BROWSER_NOKIA_S60 = Nokia S60 OSS Browser
        BROWSER_NOKIA = Nokia Browser
        BROWSER_MSN = MSN Browser
        BROWSER_MSNBOT = MSN Bot
      
        BROWSER_NETSCAPE_NAVIGATOR = Netscape Navigator
        BROWSER_GALEON = Galeon
        BROWSER_NETPOSITIVE = NetPositive
        BROWSER_PHOENIX = Phoenix

note that im not responsible for any damages coming from  this modification and your at your own but i will try to help..

restricted.php · 39.7K · 406 downloads
if i did help you .. it wont hurt to go to my profile and add a recommendation for me ;)
Quote · 21 Jun 2011

BROWSER_NETPOSITIVE = NetPositive

I'll never blacklist this browser. Also, nice post.

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 21 Jun 2011

 

BROWSER_NETPOSITIVE = NetPositive

I'll never blacklist this browser. Also, nice post.

 i also wish to never block any browser cuz every one has it's own users but some times you have to ..

if i did help you .. it wont hurt to go to my profile and add a recommendation for me ;)
Quote · 21 Jun 2011

This is exactly what I'm looking for.  I am clueless and stumbling through all of this coding stuff.  How do I add all the browsers to the list.  I just want the site to only be opened on the ipad

Quote · 25 Jan 2012

Hi Nazzal, I modded my site for the browser restriction it works really well, thanks. Is there a way that I can add a nice page, with logos pictures of the recommended browsers instead of just text please.

Quote · 12 Feb 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.