Back to vBulletin 3.7 Add-ons

Script to reject browsers
Mod Version: 1.00, by Kzyl-orda

This modification is in the archives.
vB Version: 3.7.x Rating: (0 vote - 0 average) Installs: 4
Released: 01 Jul 2008 Last Update: Never Downloads: 0
Not Supported Code Changes Re-usable Code Translations  

Hello Everyone,
I had like to reject some browsers to enter my site, so first i installed ZH-Restrict A Browser, but blocking javascript on the browser was letting you easly passing through it, then i started to write a more crude, but php, version of the addon, that is different, but with the same target, not enabling some browser to view your page.

To do so i simply entered that string on the global.php in the root directory of the vbulletin installation (global.php, so it will work from every page of your vbulletin installation):
PHP Code:
$browsername $_SERVER['HTTP_USER_AGENT'];
$kz_b1 '-yourrejectingbrowsername1-';
$kz_b2 '-yourrejectingbrowsername1-';
$kz_f1 strpos($browsername$kz_b1);
$kz_f2 strpos($browsername$kz_b2);
if (
$kz_f1 === false) {
    if (
$kz_f2 === false) {
    } else {
        
header("Location: http://www.where-you-want-to-send-people-to-do-it-externally-of-your-vbulletininstallation-or-it-will-give-you-a-loop-bug-for-example-to-download-an-other-browser-like-firefox.com");
    }
} else {
    
header("Location: http://www.where-you-want-to-send-people-to-do-it-externally-of-your-vbulletininstallation-or-it-will-give-you-a-loop-bug-for-example-to-download-an-other-browser-like-firefox.com");

I installed it after the following string, and it's working perfectly:
PHP Code:
// #############################################################################
// set the referrer cookie if URI contains a referrerid
if ($vbulletin->GPC['referrerid'] AND !$vbulletin->GPC[COOKIE_PREFIX 'referrerid'] AND !$vbulletin->userinfo['userid'] AND $vbulletin->options['usereferrer'])
{
    if (
$referrerid verify_id('user'$vbulletin->GPC['referrerid'], 0))
    {
        
vbsetcookie('referrerid'$referrerid);
    }

OFC instead of "-yourrejectingbrowsername1-" you must place the name of the browser you want to reject, for example "MSIE" (Internet explorer), "Safari" (Safari), "Firefox" (Firefox), "Opera" (Opera) i know the name of just those 4, more is Konqueror, gecho...

Instead of two you may want to reject just one browser, than:
PHP Code:
$browsername $_SERVER['HTTP_USER_AGENT'];
$kz_b1 '-yourrejectingbrowsername1-';
$kz_f1 strpos($browsername$kz_b1);
if (
$kz_f1 === false) {
} else {
    
header("Location: http://www.where-you-want-to-send-people-to-do-it-externally-of-your-vbulletininstallation-or-it-will-give-you-a-loop-bug-for-example-to-download-an-other-browser-like-firefox.com");

Here is a working example, this one reject safari and IE, and send you to firefox download page:
PHP Code:
$browsername $_SERVER['HTTP_USER_AGENT'];
$kz_b1 'MSIE';
$kz_b2 'Safari';
$kz_f1 strpos($browsername$kz_b1);
$kz_f2 strpos($browsername$kz_b2);
if (
$kz_f1 === false) {
    if (
$kz_f2 === false) {
    } else {
        
header("Location: http://www.spreadfirefox.com/en-US/worldrecord/");
    }
} else {
    
header("Location: http://www.spreadfirefox.com/en-US/worldrecord/");

I'm using Php 4.4, if you'r with a different version and it doesn't work try to change the string:
PHP Code:
header("Location: http://www.url.com"); 
With the command http_redirect, if you'll google you'll find more information about, actually i can't help without a different php version to test it.

Enjoy.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2025