Add handler for unknown IPs
This commit is contained in:
parent
120e82cfdd
commit
291c975662
|
@ -21,5 +21,12 @@ $asnr = (new Reader($asndb))->get($ip);
|
|||
$res["country"] = (new Reader($countrydb))->get($ip)["country"]["iso_code"];
|
||||
$res["asn"] = "AS".$asnr["autonomous_system_number"]." ".$asnr["autonomous_system_organization"];
|
||||
|
||||
if ($res["country"] == null) {
|
||||
$res["country"] = "_unknown";
|
||||
}
|
||||
|
||||
if ($asnr["autonomous_system_number"] == null) {
|
||||
$res["asn"] = "No GeoIP entry found, are you new?";
|
||||
}
|
||||
|
||||
print(json_encode($res));
|
||||
|
|
Loading…
Reference in a new issue