PDA

View Full Version : IP country blacklister script needed!



matty005
June 21st, 2006, 14:00
i need a script (it can be free or paid) that blocks countries IPs.

Loads of people from china use up tonnes of bandwidth on my site but they cant have hosting anyway. I need a script that blocks their IP and tells them why its blocked and gives an email to email to for support.

themoose
June 21st, 2006, 14:16
try ip2location.. have a google on it.

GamePhreak
June 21st, 2006, 15:35
1) Use ip2location to find a block of IP's you want to block.
2) Use this code on every page:



$ip = explode('.', $_SERVER['REMOTE_ADDR']);
// 255.255.255.255 becomes $ip[4](255,255,255,255)
// Let's say you want to block all IPs from 66.249.x.x ...
if($ip[0] == 66 && $ip[1] == 249) {
echo "You are blocked because we don't like Chinese hostees. If you really want hosting, email me at this address.";
exit;
}


This hasn't been tested. I just wrote it up.

matty005
June 21st, 2006, 18:24
is 66.249 definitely the chinese IP code?

I need some more countries that do not use the english language whatsoever.

GamePhreak
June 21st, 2006, 22:19
66.249 is just an example. Look up some of your visitors and you will find out.

webadpro
June 22nd, 2006, 08:12
Here's a site:


http://www.web-heaven.com/

or here's a tutorial:


http://phptutorial.info/iptocountry/the_script.html

Here's a database for all country:



http://phptutorial.info/iptocountry/identification_of_specific_countries.html

Chris L.
June 22nd, 2006, 18:56
Add it to the Account creator.... i added it to mine