PDA

View Full Version : Miscellaneous Hacks - IP Blocker Widget


DHS2
12-14-2010, 10:00 PM
Description:
Deny access to IP address array
Installation:
Create a new widget or forum side block (direct php execution)

Title for example "IP Blocker"
Description "IP Blocker Array"

Paste this code on widget configuration and save:

$blacklist = array("127.0.0.1", "127.0.0.1", "127.0.0.1");
if(in_array($_SERVER['REMOTE_ADDR'], $blacklist)) {
header("Location: http://www.fbi.gov");
exit();
}else{
$output = '<center><img src="images/misc/security.png" /></center>';
}


Setup:
change 127.0.0.1 with the ip you want to block
change "security.png" with your desidered image
change "http://www.fbi.gov" with the link desidered to redirect

This is my first version (is a simple code)
If the user's IP number is contained in the array will be redirected to the FBI homepage, otherwise this will print the image. png

zelnik
12-15-2010, 07:13 AM
sorry but i'm confused what this does over the built in ip ban that has been in vb since day 1?

DHS2
12-15-2010, 07:47 AM
sorry but i'm confused what this does over the built in ip ban that has been in vb since day 1?

This is not ip ban, is a simple mod for block determinated ip addresses to view the forum (or home page in case of publishin suite).

Delphiprogrammi
01-05-2011, 06:34 PM
this is easy it will not block the ip address contained in the array but they will be redirected to the configuerd url this might scare spammers :D

DNN
04-06-2011, 03:54 AM
I'm a lil' confused on this one too

Rahstyles
04-06-2011, 10:21 AM
Hey man this is freaking neat!!! it works.. very nice.. im supposing .. if you have multiple ip's u can put an extra "" and put the ip inbetween correct?

DHS2
04-06-2011, 03:34 PM
This is a simple code that I had to get rid of some people several months ago.
If you want you can develop in many different ways and it also interact with the database for example.

You can add more IP numbers if you want.
"127.0.0.1", "127.0.0.1", "127.0.0.1", "m.o.r.e", "m.o.r.e", "m.o.r.e" etc. etc.

(the best way is modify the code and download array from database or an external .txt file for many ip's)

(Sorry for my bad english)

DNN
04-17-2011, 08:36 AM
Where is the download link?

LorinPotter
07-23-2011, 01:04 PM
Excellent, and something that I'm wanting for my VB 3.7.

Can someone please provide me with the varable name used in 3.7 for the incoming IP?