GeoIP v2.0 (ISP, Country, City) - With updated Databases! -
Whitetiger - 10.11.2011
GeoIP (ISP, Country, City)
I have been working on a geo IP that doesn't require a plugin and that can detect more than country, at a fast speed that doesn't freeze the server. The result is this.
The INC uses SQLite this product includes GeoLite data created by MaxMind, available from
http://maxmind.com/
http://geolite.maxmind.com/download/...se/LICENSE.txt
The Country and ISP database is 15 MB, the City database alone is 100 MB, City is in a seperate SQLite database incase you decide not to upload city. (compressed, both databases together are 40 mb)
Speed test
Code:
[07:54:06] took 1 ms - GetPlayerCountry
[07:54:06] took 0 ms - GetPlayerCity
[07:54:06] took 17 ms - GetPlayerISP
If you are an SQL guru and can understand how the include works and have a faster solution to get the info even faster, please post or pm me. The point of this include is a quick SQL query that hang pause the server!
Functions
Code:
GetPlayerCountry(playerid, string[], const len = sizeof(string));
GetPlayerISP(playerid, string[], const len = sizeof(string));
GetPlayerCity(playerid, string[], const len = sizeof(string));
GetPlayerGMT(playerid);
GetIPCountry(ip[], dest[], len = sizeof(dest));
GetIPISP(ip[], dest[], len = sizeof(dest));
GetIPCity(ip[], dest[], len = sizeof(dest));
GetIPGMT(ip[]);
If you want to edit the functions or add to them looking at the databases, you can actually get thing such as Area code, Metro code, Region, Postal code, city latitude and city longitude.
Accuracy
http://www.maxmind.com/en/city_accuracy - City accuracy
Country accuracy - 99.5%
Updates
I will
try to update the database files monthly when
Maxmind updates their databases on their website
Download
GitHub
Download (Database files) (place in /scriptfiles/)
Example
New include will not work with old database files! you must update the database files AND the include for it to work!
Credits
- Whitetiger
- RaekwonDaChef
- ******
- Andreas Gohr
Re: GeoIP (ISP, Country, City) -
[ABK]Antonio - 10.11.2011
Nice post White
Re: GeoIP (ISP, Country, City) -
Lorenc_ - 10.11.2011
Nice include! Will be pretty useful for country banning :3
Re: GeoIP (ISP, Country, City) -
CrunkBankS - 10.11.2011
You a have database GeoIP for MySQL? or how to convert
Re: GeoIP (ISP, Country, City) -
Whitetiger - 10.11.2011
i wrote it originally in mysql but but it caused some problems with phpmyadmin and i figured most server hosts wouldnt allow you to import 275 MB of sql information (at least, everyone i tried wouldnt let me import even 100 mb!), so its SQLite to save people time from importing large files into their databases, and the queries where slower and would freeze the server when it was doing the look up even with threaded queries
Re: GeoIP (ISP, Country, City) -
CrunkBankS - 10.11.2011
Quote:
Originally Posted by whitetigerswt
where slower and would freeze the server when it was doing the look up even with threaded queries
|
Freeze SA:MP or MySQL server?
Re: GeoIP (ISP, Country, City) -
Whitetiger - 10.11.2011
the sa-mp server would freeze
Respuesta: GeoIP (ISP, Country, City) -
JazZ09uN - 10.11.2011
Nice post man Really
Re: GeoIP (ISP, Country, City) -
Norn - 10.11.2011
Very nice script!
Quote:
Originally Posted by CrunkBankS
Freeze SA:MP or MySQL server?
|
The other filterscript that's released is poorly coded and hangs the server if it doesn't find the result.
Re: GeoIP (ISP, Country, City) -
Slice - 10.11.2011
Quote:
Originally Posted by Norn
Very nice script!
The other filterscript that's released is poorly coded and hangs the server if it doesn't find the result.
|
I hope you're not referring to mine.
Respuesta: GeoIP (ISP, Country, City) -
JazZ09uN - 10.11.2011
what name i give in
filterscripts
Re: GeoIP (ISP, Country, City) -
Norn - 10.11.2011
Quote:
Originally Posted by Slice
I hope you're not referring to mine. 
|
No no yours using http which is fine it was some indian guy haha.
Re: GeoIP (ISP, Country, City) -
Richie - 10.11.2011
I get: Country, ISP, City = unknown.
When i check my IP @ maxmind site all info shows, why?
Re: GeoIP (ISP, Country, City) -
CJ101 - 10.11.2011
as far as i know, MaxMind has costs on certain IP services. Is this the free version, or the paid version?
also, could this be imported so i can import it into a mysql database? (or create a new one)
Re: GeoIP (ISP, Country, City) -
Whitetiger - 10.11.2011
it is the GeoLite free databases
Quote:
Originally Posted by Richie
I get: Country, ISP, City = unknown.
When i check my IP @ maxmind site all info shows, why?
|
pm me your ip and ill see if i can get it to work
EDIT: if people really want use in mysql ill post the last mysql version i have, but i can't promise that it will even work, you're welcome to edit it
What you need:
- SQL db tables:
http://pastebin.com/9H2Pj1zS
- MaxMind
Country database,
City database, and
GeoASN In .CSV format (its all on there site)
- mysql database
when importing the files you should do them like this:
with the corresponding tables
GeoIPASNum2.csv -> geo_isp
GeoIPCountryWhois.csv -> ip_country
GeoLiteCity-Blocks.csv -> ip_city
GeoLiteCity-Location.csv -> ip_city_locations
Download (mysql FS usage example)
Download (mysql FS usage example, pastebin)
I highly recommend you dont use mysql!
edit 2: there was a problem with the original .inc, please update it will save you time in the long run
Re: GeoIP (ISP, Country, City) -
ViniBorn - 11.11.2011
Interesting
Re: GeoIP (ISP, Country, City) -
pmkrz - 11.11.2011
Nice work, whitetigerswt! (:
Re: GeoIP (ISP, Country, City) -
MaTrIx4057 - 11.11.2011
NICE NIGA!
Re: GeoIP (ISP, Country, City) -
HyperZ - 14.11.2011
< Removed >
Re: GeoIP (ISP, Country, City) -
MrDaddY - 14.11.2011
Where did you found the .db files on Maxmind's download site? (
http://geolite.maxmind.com/download/geoip/database/)