From a31396fb8c67f27a0055e4c4a6fa95e3cde24d1a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Apr 2015 23:53:58 +0200 Subject: Small improvements. --- ifconfig/ifconfig.php | 60 ---------------------- ifconfig/index.php | 60 ---------------------- ifconfig/template.php | 132 ------------------------------------------------- ip/ifconfig.php | 60 ++++++++++++++++++++++ ip/index.php | 60 ++++++++++++++++++++++ ip/template.php | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ linkshorter/config.php | 3 +- tools/navbar.php | 2 +- 8 files changed, 255 insertions(+), 254 deletions(-) delete mode 100644 ifconfig/ifconfig.php delete mode 100644 ifconfig/index.php delete mode 100644 ifconfig/template.php create mode 100644 ip/ifconfig.php create mode 100644 ip/index.php create mode 100644 ip/template.php diff --git a/ifconfig/ifconfig.php b/ifconfig/ifconfig.php deleted file mode 100644 index 33ec5ba..0000000 --- a/ifconfig/ifconfig.php +++ /dev/null @@ -1,60 +0,0 @@ -ip=$ip; - } - - public function getHeader(){ - $headers = ''; - foreach ($_SERVER as $name => $value){ - if (substr($name, 0, 5) == 'HTTP_'){ - $headers[str_replace(' ', '-', ucwords( strtolower( str_replace( '_', ' ', substr( $name, 5) ) ) ) )] = $value; - } - } - return $headers; - } - - public function getAllGeoipRecords(){ - - $tmp = geoip_record_by_name( $this->ip ); - if( $tmp ){ - unset($tmp['dma_code']); - unset($tmp['area_code']); - } else { - $tmp = array ( "status" => "Data not available"); - } - - return $tmp; - } - - public function encodeJson($value){ - - if( empty($value) || is_null($value) || $value == "" ) - return json_encode($output = array( "status" => "failure" )); - else - $output = array( "status" => "success" ); - - if ( ! is_array($value) ){ - $output[] = $value; - } else { - $output = array_merge($output, $value); - } - - return json_encode($output); - } - - public function getReverseDNS($ip = NULL){ - if ( is_null($ip) ) - $ip = $this->ip; - - return gethostbyaddr($ip); - } - - public function __destruct(){ - return true; - } -} 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 @@ - $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; -} diff --git a/ifconfig/template.php b/ifconfig/template.php deleted file mode 100644 index 50e9b74..0000000 --- a/ifconfig/template.php +++ /dev/null @@ -1,132 +0,0 @@ - - -
- - - - - -$ curl http://tools.iamfabulous.de/ifconfig/ => $ curl http://tools.iamfabulous.de/ifconfig/?output=json$ curl http://tools.iamfabulous.de/ifconfig/?geoip=1&header=1&output=json
-
-
- $ curl http://tools.iamfabulous.de/ifconfig/ => $ curl http://tools.iamfabulous.de/ifconfig/?output=json$ curl http://tools.iamfabulous.de/ifconfig/?geoip=1&header=1&output=json
+
+
+