Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Script to reject browsers Details »»
Script to reject browsers
Version: 1.00, by Kzyl-orda Kzyl-orda is offline
Developer Last Online: Apr 2014 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.7.x Rating:
Released: 06-30-2008 Last Update: Never Installs: 4
Re-useable Code Code Changes Translations  
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-01-2008, 02:27 PM
dannykilla's Avatar
dannykilla dannykilla is offline
 
Join Date: Jun 2007
Location: Manchester, UK
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sounds Awesome, but do you have a screenshot?
Also can you reject certain browser versions for example IE6 ?
Reply With Quote
  #3  
Old 07-01-2008, 03:24 PM
Brandon Sheley's Avatar
Brandon Sheley Brandon Sheley is offline
 
Join Date: Mar 2005
Location: Google Kansas
Posts: 4,678
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

a demo link would be nice, so we could try different browsers
Reply With Quote
  #4  
Old 07-01-2008, 05:08 PM
indie2industry's Avatar
indie2industry indie2industry is offline
 
Join Date: Jan 2008
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

why would anyone want to do this??? Wouldn't it just restrict users from your forum???

Nice mod, but I definatly can not use this one....

I may be slow, lol, but what are the up-side to restricting a browser from your site?
Reply With Quote
  #5  
Old 07-01-2008, 11:58 PM
TonySkullz TonySkullz is offline
 
Join Date: Feb 2008
Location: Florida
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree with the above, what's the purpose of completely restricting a browser to use your site? Restricting browsers access to specific sections for incompatibility reasons is more understandable, and is already easily done with conditionals. So, how does anyone benefit from this?

To clarify, I'm not meaning that in a rude way if it seems so, I'm just curious.
Reply With Quote
  #6  
Old 07-02-2008, 12:26 AM
Q-v-n-s-Q Q-v-n-s-Q is offline
 
Join Date: Mar 2005
Posts: 289
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you for the release
Reply With Quote
  #7  
Old 07-02-2008, 12:46 AM
Josh1 Josh1 is offline
 
Join Date: Mar 2006
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And why the heck would you want to do this?
Reply With Quote
  #8  
Old 07-02-2008, 07:39 AM
Kzyl-orda Kzyl-orda is offline
 
Join Date: Jun 2008
Location: Venice
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm back!

@Loco.M
You can see a working demo at my own website if you'll like www.perditionpoetry.com.
But the site itself will not be completed untill september, just in time for Left 4 Dead, great new game from Valve and Turtle Rock, with zombie and much more .
Then don't troll it too much .

@dannykilla
To restrict specific browser like IE 6, you can download the browser first (or IE Net Render if you'r using firefox 3.0), than create a clean *.php page, upload it in your website tests directory.
In the file (within <body></body> of the basic HTML code)write:
PHP Code:
<?php
$browser 
$_SERVER['HTTP_USER_AGENT'];
echo 
"$browser";
?>
Than you'll see the possible specific keyword fo the browser you'r using.
IE 6 is "MSIE 6.0", anyway if you'll like to reject more than 2 browser (more than two IE version for example, and sending people to download the last version) modifing the script is really simple, just ask and I'll help you.

@Diffidents
The above one is an example of a possible utility for the addon, how to use it's all about you.

On my side,
I thought this addong while creating a restricted gaming community for my friends, I'm a nerd gamer.
There is no incompatibility issues to avoid, i know how to solve them if i need to, if you are a commercial developer you should use it with real care, as others said kicking people from the site is not usually a commercial benefit, in my side I'm not interested in making money, but in choosing who I'm going to play with, so i can kick people from my site, and be selective.

In specific, the reason i want to reject other browser is also to force people using firefox, or browser different from IE or safari, and this is a my personal battle. I'm not going to explain the reason here because it's not the right place to, it's a my personal choise, and my personal ideals.
Second, as i said not allowing IE i make too young or non nerd users harder to join my community, and that is my target. (I'm not saying that IE is a browser for child or casual users at all. don't misunderstand!)

I'm not surprised if you'll find it silly or useless, it's was invented mainly just for some zealots of hardcore gaming and firefox supported, and even if just 2 people installed it, and maybe there will not be many more, this already make me happy, since this is also my first release. After 2 weeks i bought vb.

I hope to have answered all your question .
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:13 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05460 seconds
  • Memory Usage 2,299KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete