Kzyl-orda
06-30-2008, 10:00 PM
Hello Everyone,
I had like to reject some browsers to enter my site, so first i installed ZH-Restrict A Browser (https://vborg.vbsupport.ru/showthread.php?t=165624), 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):
$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:
// ################################################## ###########################
// 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:
$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:
$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:
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.
I had like to reject some browsers to enter my site, so first i installed ZH-Restrict A Browser (https://vborg.vbsupport.ru/showthread.php?t=165624), 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):
$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:
// ################################################## ###########################
// 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:
$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:
$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:
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.