diff options
Diffstat (limited to 'ifconfig/index.php')
| -rw-r--r-- | ifconfig/index.php | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/ifconfig/index.php b/ifconfig/index.php deleted file mode 100644 index a390ec2..0000000 --- a/ifconfig/index.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -if ( strpos($_SERVER['HTTP_USER_AGENT'], 'curl') !== false ){ - if ( empty($_GET) ){ - echo $_SERVER["REMOTE_ADDR"]; - exit; - } -} - -if ( empty($_GET) ){ - header($_SERVER["SERVER_PROTOCOL"] . " 302 Moved"); - header("Location: http://".$_SERVER["HTTP_HOST"].str_replace("/index.php", "", $_SERVER["PHP_SELF"] )."/?ip=".$_SERVER["REMOTE_ADDR"]."&geoip=1&header=1&output=html"); - exit; -} - -if ( ! isset($_GET["ip"]) || $_GET["ip"] == "" ){ - $ip = $_SERVER["REMOTE_ADDR"]; -} else { - if( preg_match("/([0-9]+\.){3}[0-9]+/", $_GET["ip"]) ){ - $ip = $_GET["ip"]; - } else { - $ip = gethostbyname($_GET["ip"]); - } -} - -require 'ifconfig.php'; - -$if = new Ifconfig($ip); - -$result = array("ip" => $ip, "hostname" => $if->getReverseDNS()); - -if( isset($_GET["geoip"]) && $_GET["geoip"] != 0){ - $geoip = $result = array_merge($result, $if->getAllGeoipRecords()); -} - -if( isset($_GET["header"]) && $_GET["header"] != 0){ - $header = $if->getHeader(); - $result = array_merge($result, $header); -} - -if( ! isset($_GET["output"]) || $_GET["output"] == "" ){ - $_GET["output"] = "html"; -} - -switch($_GET["output"]){ - case("json"): - header("Content-Type: application/json"); - echo $if->encodeJson($result); - break; - case("html"): - require 'template.php'; - break; - case("php"): - header("Content-Type: text/plain"); - echo serialize($result); - break; - default: - require 'template.php'; - break; -} |
