aboutsummaryrefslogtreecommitdiff
path: root/admin/api/getIpLocation.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/api/getIpLocation.php')
-rw-r--r--admin/api/getIpLocation.php38
1 files changed, 0 insertions, 38 deletions
diff --git a/admin/api/getIpLocation.php b/admin/api/getIpLocation.php
deleted file mode 100644
index c40d96e..0000000
--- a/admin/api/getIpLocation.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json")) {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json", "[]");
-}
-
-$ipCache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json"), true);
-
-$data = null;
-foreach ($ipCache as $ip => $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("<span class='text-muted'>" . l("Local IP address", "Adresse IP locale") . "</span>");
-} else {
- if ($data["geoplugin_inEU"]) {
- die($data["geoplugin_countryName"] . " <span class='badge text-light border-light' style='border:1px solid;vertical-align: middle;'>" . l("EU", "UE") . "</span>");
- } else {
- die($data["geoplugin_countryName"]);
- }
-} \ No newline at end of file