Skip to content
Snippets Groups Projects
Commit d943b02b authored by deuce's avatar deuce
Browse files

Fix everything.

parent ce1f2abf
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
if(!js.global || js.global.HTTPRequest==undefined) if(!js.global || js.global.HTTPRequest==undefined)
load("http.js"); load("http.js");
var geoipAPIKey='a1ddc4963461ca20bffd54bb926ce74dc1ecbb8a421122cdc3cdfef616f5aad1'; // Enter your API info here!
if(geoipAPIKey==undefined) {
log("You need to get a key from http://ipinfodb.com/register.php");
exit;
}
function get_geoip(host, countryonly) function get_geoip(host, countryonly)
{ {
var GeoIP; var GeoIP;
...@@ -37,24 +44,25 @@ function get_geoip(host, countryonly) ...@@ -37,24 +44,25 @@ function get_geoip(host, countryonly)
// Get the best URL // Get the best URL
if(countryonly) { if(countryonly) {
if(isarray) if(isarray)
geoip_url='http://ipinfodb.com/ip_query2_country.php?output=json&ip='+encodeURIComponent(host.join(',')); geoip_url='http://api.ipinfodb.com/v3/ip-country/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host.join(','));
else if(ishost) else if(ishost)
geoip_url='http://ipinfodb.com/ip_query2_country.php?output=json&ip='+encodeURIComponent(host); geoip_url='http://api.ipinfodb.com/v3/ip-country/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host);
else else
geoip_url='http://ipinfodb.com/ip_query_country.php?output=json&ip='+encodeURIComponent(host); geoip_url='http://api.ipinfodb.com/v3/ip-country/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host);
} }
else { else {
if(isarray) if(isarray)
geoip_url='http://ipinfodb.com/ip_query2.php?output=json&ip='+encodeURIComponent(host.join(',')); geoip_url='http://api.ipinfodb.com/v3/ip-city/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host.join(','));
else if(ishost) else if(ishost)
geoip_url='http://ipinfodb.com/ip_query2.php?output=json&ip='+encodeURIComponent(host); geoip_url='http://api.ipinfodb.com/v3/ip-city/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host);
else else
geoip_url='http://ipinfodb.com/ip_query.php?output=json&ip='+encodeURIComponent(host); geoip_url='http://api.ipinfodb.com/v3/ip-city/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host);
} }
try { try {
result='ret='+new HTTPRequest().Get(geoip_url); do {
GeoIP=js.eval(result); result='ret='+new HTTPRequest().Get(geoip_url);
GeoIP=js.eval(result);
} while(GeoIP==undefined);
if(GeoIP.Locations != undefined) { if(GeoIP.Locations != undefined) {
if(isarray) if(isarray)
return GeoIP.Locations; return GeoIP.Locations;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment