View Full Version : Miscellaneous Hacks - Ban IP's In vBulletin Options Easily
Simon Lloyd
08-07-2011, 10:00 PM
What this mod does
With this simple mod you can enter a list of IP's that you want to ban (redirect) one per line, when trying to access your site the user of the IP will be redirected to an obscure google page with a 301 permanent redirect.
What this mod won't do
With this mod you cannot ban partial ranged IP's laid out like this 2.23.123 - 2.23.130
How to install
Simply go to Admincp>Manage Products and import product-baniparray.xml
Please mark as installed if you use this!
Version History
v1.0.1
Made it possible to use partial IP addresses
v1.0.2
Added custom redirect message box
Added custom redirect url box
Added IP Range boxes for banning IP's that fall within range
Ranged IP's parsed during checks
vbetaadded for test purposes 9/08/2011
Beta has email notification ability, this beta is for those of you that wish to test it and feed back!
Checked range block working only against my IP range, please report any bugs!
bosanci28
08-08-2011, 02:37 AM
well when i enable in 4.1.5 i get this error:
Warning: stristr() [function.stristr]: Empty delimiter in [path]/includes/class_bootstrap.php(917) : eval()'d code on line 13
Simon Lloyd
08-08-2011, 02:54 AM
When you enabled it did you have any ip's in the list? if not it will produce an error.
bosanci28
08-08-2011, 04:32 AM
yap,that fixed it.
now let say i ban someones ip,and then i will erase his account,what will happen then?
can he register again or?
thanks friend.
Simon Lloyd
08-08-2011, 04:46 PM
yap,that fixed it.
now let say i ban someones ip,and then i will erase his account,what will happen then?
can he register again or?
thanks friend.No not with the same IP, if they use the same IP they will never get to see your site again only the redirect site. There will be further enhancements coming soon with this mod :)
FReeSTER
08-08-2011, 06:12 PM
No not with the same IP, if they use the same IP they will never get to see your site again only the redirect site. There will be further enhancements coming soon with this mod :)
Good stuff, I will tag for later use. Cant wait for more options. lol
DonosOdD
08-08-2011, 06:45 PM
I can see this is good work in progress. Tagged for later.
steve1966
08-08-2011, 07:35 PM
Hi thank you but where do i add the isp in the usual banning options page?
Simon Lloyd
08-08-2011, 10:32 PM
If you mean in my mod then it's self explanatory. This mod does not interact with or affect vb's built in banning options page.
Simon Lloyd
08-08-2011, 10:45 PM
Product updated - new enhancements!
Boofo
08-08-2011, 10:49 PM
Looks good. How about an email notification on select blocked IPs?
Simon Lloyd
08-08-2011, 10:54 PM
Lol, you haven't marked this as installed!, i can do that but lets see how the mod floats for now before i go messing around with it, if everyone is happy over the next week then i'll add either emailing, creating a thread or writing to a log on your server.
Simon Lloyd
08-08-2011, 10:55 PM
To be honest the log is probably the better way to go or you could get thousands of emails or threads created!
Boofo
08-08-2011, 11:13 PM
There, I marked it as installed even though I have not installed it yet. The email option would work best for me, but only for those IPs I designate, not for all of them in the setting.
Simon Lloyd
08-08-2011, 11:18 PM
Well thats probably going to be an add on then rather than a mod change as i think you are talking about not having emails from the blocked range and not having emails from those sigularly blocked, you want to be able to have a section where you enter IP's and emails sent to you if they access your site?
Simon Lloyd
08-09-2011, 12:08 AM
Beat product added with email capability. :)
Boofo
08-09-2011, 12:44 AM
Well thats probably going to be an add on then rather than a mod change as i think you are talking about not having emails from the blocked range and not having emails from those sigularly blocked, you want to be able to have a section where you enter IP's and emails sent to you if they access your site?
Yes. Whether they are in the block setting or not. I will test it and let you know.
Simon Lloyd
08-09-2011, 12:51 AM
Boofo, uninstall that last beta and install the new one, the last one had a typo so wouldn't work!
Boofo
08-09-2011, 01:12 AM
Downloaded. Thanks.
steviewonder44
02-07-2012, 08:45 PM
Thanks this will help
Simon Lloyd
02-07-2012, 08:46 PM
Hope you like it :)
TombstoneWarrior
02-12-2012, 12:55 AM
should i use the beta.xml or the 4.xml?
Simon Lloyd
02-12-2012, 05:59 AM
The beta is stable it was in beta when i added the emailing capability, thats the only difference, so if you dont want emailing capability then the 4.xml is fine :)
TombstoneWarrior
02-12-2012, 07:04 AM
installed in 4.1.9 and get this error evveytime with both xml files>>>>>>> error>>>>>>>>>>> Warning: stristr() [function.stristr]: Empty delimiter in [path]/includes/class_bootstrap.php(965) : eval()'d code on line 12
BlueCheri
02-12-2012, 07:14 AM
I was getting following error:
Warning: stristr() [function.stristr]: Empty delimiter in [path]/includes/class_bootstrap.php(965) : eval()'d code on line 181
G!
installed in 4.1.9 and get this error evveytime with both xml files>>>>>>> error>>>>>>>>>>> Warning: stristr() [function.stristr]: Empty delimiter in [path]/includes/class_bootstrap.php(965) : eval()'d code on line 12
Simon Lloyd
02-12-2012, 09:10 AM
If you've installed this please mark it as installed :)
You got that error because you have the mod activated but no IP's in the list to deal with, deactivate it until you have use for it ;)
TombstoneWarrior
02-12-2012, 06:47 PM
If you've installed this please mark it as installed :)
You got that error because you have the mod activated but no IP's in the list to deal with, deactivate it until you have use for it ;) i uninstalled it thats why its not marked as installed... ill wait to install if i need this mod
TombstoneWarrior
03-09-2012, 01:39 PM
5 stars and marked as installed reinstalled since you gave me he code error reason thank you very much!!!
Simon Lloyd
03-09-2012, 03:02 PM
Your welcome, try out my ban spider by useragent and you'll save on valuable resources too :)
TheSupportForum
11-02-2012, 07:43 PM
bug found :
PHP Fatal error: Cannot redeclare ip_redirect() (previously declared in
/archive/global.php(40) : eval()'d code:95) in /includes/class_bootstrap.php(996) :
eval()'d code on line 99
Simon Lloyd
11-02-2012, 09:44 PM
Edit: Must be a conflict with another mod you have.
TheSupportForum
11-02-2012, 10:22 PM
Edit: Must be a conflict with another mod you have.
i dont have any IP blocking scripts that use your
function ip_redirect($to, $code = '301 Permanently Moved')
which points to your script
its does seem obvious to me its your function that's causing the issue shown in the erro_log, this is not shown on the main forum as an eror
PHP Fatal error: Cannot redeclare ip_redirect() (previously declared in /archive/global.php(40) : eval()'d code:95) in /includes/class_bootstrap.php(996) : eval()'d code on line 99
Simon Lloyd
11-03-2012, 09:01 AM
Can you check your /archive/global.php to see if it contains ip_redirect?
TheSupportForum
11-03-2012, 09:42 AM
Can you check your /archive/global.php to see if it contains ip_redirect?
yeah
as its a fresh install no pronlem
tambo
11-03-2012, 09:44 AM
Other than the ability to redirect to a custom page (which is quite an attractive feature, BTW), what is the difference between this mod and the standard IP Banning options under:
ACP > User Banning Options > Banned IP Addresses
Thanks,
TM
TheSupportForum
11-03-2012, 09:45 AM
for 4.2.0 pl3 it seems to be
exec_header_redirect(fetch_seo_url('forumhome|bbur l', array()));
which has a header redirect, so 2 redirects are occurring, your ip_redirect
TheSupportForum
11-03-2012, 09:46 AM
Other than the ability to redirect to a custom page (which is quite an attractive feature, BTW), what is the difference between this mod and the standard IP Banning options under:
ACP > User Banning Options > Banned IP Addresses
Thanks,
TM
you have a point there, i suppose the developer should use that array in the plugin instead of a new textarea
TheSupportForum
11-03-2012, 10:00 AM
Can you check your /archive/global.php to see if it contains ip_redirect?
just checking it furthur this is the whole script that is affecting it
// ################################################## ###########################
// ### CACHE PERMISSIONS AND GRAB $permissions
// get the combined permissions for the current user
// this also creates the $fpermscache containing the user's forum permissions
$permissions = cache_permissions($vbulletin->userinfo);
$vbulletin->userinfo['permissions'] =& $permissions;
// ################################################## ###########################
// check that board is active - if not admin, then display error
if ((!$vbulletin->options['bbactive'] AND !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])) OR !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']))
{
exec_header_redirect(fetch_seo_url('forumhome|bbur l', array()));
}
// if password is expired, deny access
if ($vbulletin->userinfo['userid'] AND $permissions['passwordexpires'])
{
$passworddaysold = floor((TIMENOW - $vbulletin->userinfo['passworddate']) / 86400);
if ($passworddaysold >= $permissions['passwordexpires'])
{
exec_header_redirect(fetch_seo_url('forumhome|bbur l', array()));
}
}
verify_ip_ban();
$cache_templates = array('ad_archive_above_content1', 'ad_archive_above_content2', 'ad_archive_below_content');
($hook = vBulletinHook::fetch_hook('archive_global')) ? eval($hook) : false;
cache_templates($cache_templates, $style['templatelist']);
unset($cache_templates);
Simon Lloyd
11-03-2012, 10:12 AM
Other than the ability to redirect to a custom page (which is quite an attractive feature, BTW), what is the difference between this mod and the standard IP Banning options under:
ACP > User Banning Options > Banned IP Addresses
Thanks,
TM
This does much more, did you read the settings?, you can ban single ip's, ip ranges, redirect to url of your choice and have notification if specific ip's have accessed your site - different enough? :)
Simon Lloyd
11-03-2012, 10:15 AM
just checking it furthur this is the whole script that is affecting it
Code displayed above!
Thats the archive/global.php, i cant seem to recreate it on my test site, my mod works at style fetch, so pretty much before anything else has been executed so redirect happens then, do you have any mods or custom code in your fresh install?
TheSupportForum
11-03-2012, 10:27 AM
Thats the archive/global.php, i cant seem to recreate it on my test site, my mod works at style fetch, so pretty much before anything else has been executed so redirect happens then, do you have any mods or custom code in your fresh install?
no, i am using vb 4.2.0 pl3 i only noticed it yesterday in the logs
its a fresh install
Simon Lloyd
11-03-2012, 10:35 AM
unfortunately i don't have vb4.0.2 just 4.1.14PL9 i will look and see what i can do though :)
TheSupportForum
11-03-2012, 10:42 AM
Thats the archive/global.php, i cant seem to recreate it on my test site, my mod works at style fetch, so pretty much before anything else has been executed so redirect happens then, do you have any mods or custom code in your fresh install?
if thats the case /archive/index.php can't be redirected as designed if yours is running first which may be causing the issue which is why it shows that error in the log
off
i though that global_start was run first before everything else, which is what the mods told me style_fetch maybe run sometime after that
Simon Lloyd
11-03-2012, 10:53 AM
Look at it like this:
User calls for url>global.php>global.php redirect>hook stylefetch gets called>user redirected because he's in ban list
So if thats the scenario then global.php has executed before the hook is called, so i still dont understand why it is then causing an issue.
Give me a few days, i have a friend who has vb4.0.2 and i'll ask if i can use his test site to work on this.
Feel free in the meantime to change the hook to global_start and see how you go on.
Simon Lloyd
11-03-2012, 11:23 AM
I've been looking at this trying to recreate it on my vb4 test site and i found that i can only recreate it if i add require_once "global.php"; then i get your issue exactly. I'll keep you posted.
TheSupportForum
11-03-2012, 01:22 PM
I've been looking at this trying to recreate it on my vb4 test site and i found that i can only recreate it if i add require_once "global.php"; then i get your issue exactly. I'll keep you posted.
thanks for the update
Simon Lloyd
11-03-2012, 03:56 PM
Hi Simon, can you try importing this product with overwrite and see how you go on?, i cant raise my friend at the moment so i've just excluded global.php in the script.
TheSupportForum
11-03-2012, 04:06 PM
Hi Simon, can you try importing this product with overwrite and see how you go on?, i cant raise my friend at the moment so i've just excluded global.php in the script.
installed it now, also removed the error_log file
i will get back to you today with feedback on the changes :)
TheSupportForum
11-03-2012, 04:22 PM
the following error is
PHP Parse error: syntax error, unexpected '{' in /home/hind1980/public_html/legijastranaca.com/includes/class_dm_user.php(1865) : eval()'d code on line 1
Simon Lloyd
11-03-2012, 04:47 PM
Ok, back to the drawing board!!, i don't get the error on vb4.1.14
TheSupportForum
11-03-2012, 04:50 PM
Ok, back to the drawing board!!, i don't get the error on vb4.1.14
the error does not appear on the forum, it only appears in the error_log.log file in forum root
the forum does not show any error with code
Simon Lloyd
11-03-2012, 05:25 PM
I undersatnd that but im not seeing it in my error logs at all, i've checked the syntax of the latest code i've given here http://www.piliapp.com/php-syntax-check/ and it all checks out - im at a loss until i can get my hands on my friends vb4.02 and try it there.
TheSupportForum
11-03-2012, 05:29 PM
I undersatnd that but im not seeing it in my error logs at all, i've checked the syntax of the latest code i've given here http://www.piliapp.com/php-syntax-check/ and it all checks out - im at a loss until i can get my hands on my friends vb4.02 and try it there.
thats no problem at all, i only noticed it the other day in my logs
strange it shows in the logs and not on the main page :(
dwerden
12-14-2012, 02:01 PM
I have installed this add-on into my VB 4.2, but I can't figure out how to add the IP list. I'm new to using plug-ins, so maybe I'm missing something obvious (probably!). How do I get to the right screen to do this?
Thanks!
Simon Lloyd
12-14-2012, 08:40 PM
AdminCp>Settings>Ban IP's
dwerden
12-14-2012, 09:13 PM
Ah, I KNEW I was missing something simple! Thanks for pointing out the menu string.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.