Forum Moderators: DixonJones

Message Too Old, No Replies

Does this scripts excist?

keeping entire country's out..

         

janice

10:56 pm on Dec 20, 2003 (gmt 0)

10+ Year Member



hi all,ive just spend almost an hour reading all stuff posted about blocking ip's and country's..
But not a satisfied answer in my position.
im about to set up a site using nuke ( yeah just like it) and i know of the scripts around banning ip's but there seems to be 1 major prob and that is how to keep out entire country's!
the scripts that do excist isnt made for ip ranges.
Some do ....BUT then the range is sort of saved into the system.
a good friend did that and ended up with almost 900 pages so he had to delete that again.
then we have the more simpler and here's a copy of it....

$iplist = array("IP1","IP2","IP3"); // the list of banned IPs
$ip = getenv("REMOTE_ADDR"); // get the visitors IP address
// echo "$ip";
$found = false;
foreach ($iplist as $value) { // scan the list
if (strpos($ip, $value) === 0){
$found = true;
}
}

if ($found == true) {
echo "top.location = \"not_wanted.html\";\n"; // page to divert to
}

Thats all,but now.....as you can see it asks for ip,ip,ip....but can this be changed so it works like a ip range...?
I dont have the time to put 100.000 ip's in that file.
So can i get some help on this please.

Thank you,

janice

jdMorgan

1:44 am on Dec 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



janice,

Welcome to WebmasterWorld [webmasterworld.com]!

This is a big can of worms...

Your script can undoubtedly be modified to parse out the 'classes' of IP addresses, leaving off the last one, two or three digit groups for comparison purposes.

But the problem is larger than that; The internet numbering system does not comprehend national boundaries, and number ranges are allocated as requested. So for example, Australia, New Zealand, and parts of India are mixed in with the large blocks allocated to China.

Any solution is necessarily huge and maintenance-intensive. It takes a staff.

As a result, the best solutions are pay-for-play. You pay them to provide an up-to-the minute translation of IP addresses to countries. When IPv64 rolls out, this will make the number of available IP addresses larger by a factor of 4,294,967,296!

Doing a search for geo-targeting and IP will turn up some solutions.

Jim

<edit> previous thread on IP vs. location: [webmasterworld.com...] </edit>

janice

1:21 pm on Dec 22, 2003 (gmt 0)

10+ Year Member



ok thanks jim,

i never expected it to be easy.
well ive changed the script a little bit so i only use the part that lets me refuse ip's starting with the 6 first numbers.
atleast its something..