vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Forum Display Enhancements - Script to reject browsers (https://vborg.vbsupport.ru/showthread.php?t=184063)

Kzyl-orda 06-30-2008 10:00 PM

Script to reject browsers
 
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. :confused:

Enjoy.

dannykilla 07-01-2008 02:27 PM

Sounds Awesome, but do you have a screenshot?
Also can you reject certain browser versions for example IE6 ?

Brandon Sheley 07-01-2008 03:24 PM

a demo link would be nice, so we could try different browsers

indie2industry 07-01-2008 05:08 PM

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?

TonySkullz 07-01-2008 11:58 PM

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. :)

Q-v-n-s-Q 07-02-2008 12:26 AM

thank you for the release

Josh1 07-02-2008 12:46 AM

And why the heck would you want to do this?

Kzyl-orda 07-02-2008 07:39 AM

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 :D.
Then don't troll it too much :rolleyes: .

@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 :D
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 ;) .


All times are GMT. The time now is 01:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01031 seconds
  • Memory Usage 1,759KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete