From a20dff82a7e2602738f847fa4f1428af3235aafc Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 8 Aug 2021 18:27:46 +0200 Subject: Updating... the update... that updates --- admin/api/getIpLocation.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 admin/api/getIpLocation.php (limited to 'admin/api/getIpLocation.php') diff --git a/admin/api/getIpLocation.php b/admin/api/getIpLocation.php new file mode 100644 index 0000000..fe34438 --- /dev/null +++ b/admin/api/getIpLocation.php @@ -0,0 +1,38 @@ + $item) { + if ($ip === $_GET['_']) { + $data = $item; + } +} + +if ($data === null) { + $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $arg)); + $ipCache[$_GET['_']] = $data; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json", json_encode($ipCache)); +} + +if ($data["geoplugin_status"] === 404) { + die("Local IP address"); +} else { + if ($data["geoplugin_inEU"]) { + die($data["geoplugin_countryName"] . " EU"); + } else { + die($data["geoplugin_countryName"]); + } +} \ No newline at end of file -- cgit