PDA

View Full Version : IP Location Findwer and Blocker


poprulz
02-14-2007, 12:17 PM
I happend to chek this thread

https://vborg.vbsupport.ru/showthread.php?t=53923

which was for 2.2.x to automatically detect new users at registrations and asign to the country by checking the ip.

I was wondering if a system is feasible where the user is checked by the ip and if he/she is from particular location deny access or add to a particular user group directly.

So that the usergroup has custom permissions. It sounds cool... so that users could be distinguished by location or country.

IP pool space for countries could be used for this i guess. any light in this topic?

Webdude?
05-31-2007, 03:46 PM
So far I have found....

Updated List of IP's
http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip

A script to import the file to your database
http://willem.creationpoint.nl/ip2country/import_ip_to_country.phps

And the script you link to above
https://vborg.vbsupport.ru/showthread.php?t=53923

Or as this post shows
I wrote a little script to convert the csv file to sql import script:
#!/bin/php
$lines=file('ip-to-country.csv');
foreach($lines as $line){
$line=trim($line);
if(!preg_match('/^"([0-9]+)","([0-9]+)","(.{2})","(.{3})","(.*)"$/',$line,$matches)){
echo "error";
}else{
echo 'insert into ip2c values("'.($matches[1]).'","'.($matches[2]).'","'.($matches[3]).'","'.($matches[4]).'","'.($matches[5]).'");'."\n";
}
}
?>

Usage:
copy this script and .csv file in the same dir then run:
convert.php >ip2c.sql


Maybe a coder can update it, or maybe I will... though I prefer a "professional" to do it.... I'm sure there's one here around somewhere :D

Actually, I may go ahead and try this as I need this.

Webdude?
05-31-2007, 05:59 PM
The old hack doesnt work. However, if anyone feels like updating the hack, here's an updated sql import file for it.

sv1cec
07-18-2012, 08:27 AM
I am using the IP2COUNTRY data in my site, to trap spammers. What I do, is give them a drop-down menu with selection for the country they are in. Then I compare that country with the country shown by their registration IP. If those two do not match, then the person or the script attempting to register gets a "Thank you for your registration, you will receive an email etc" message, which of course they never receive, while their IP is entered in the banned IP list in the vBulletin options. Another simple anti-spam measure, is to check the TimeZone of the country entered, vs the Timezone selected by the person/script trying to register. If they do not match, then again, the IP is banned. Finally, one other measure, simple but effective: if the time taken to fill in the registration form is less than (say) 20 seconds, there is no way a person is trying to register, it's probably a script, so again, the IP is banned. In about one year I am running these checks, they has trapped more than 25,000 IP addresses and greatly reduced the number of spammers registering in our site.

However, I've done those modes in vB 3.0.17. I have no idea how to do the same things in 4.2, so if someone can do it, I would be grateful.