From 6435c9100bffea6a2df7603ef62ae00d64c92831 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Tue, 23 May 2023 18:35:45 -0500 Subject: initial fork: updating for php8 --- ifconfig.php | 153 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 68 insertions(+), 85 deletions(-) (limited to 'ifconfig.php') diff --git a/ifconfig.php b/ifconfig.php index fd0f876..c6fc39b 100644 --- a/ifconfig.php +++ b/ifconfig.php @@ -1,45 +1,25 @@ $_SERVER['REMOTE_ADDR'], - 'host' => (isset($_SERVER['REMOTE_ADDR']) ? gethostbyaddr($_SERVER['REMOTE_ADDR']) : ""), - 'port' => $_SERVER['REMOTE_PORT'], - 'ua' => $_SERVER['HTTP_USER_AGENT'], - 'lang' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], - 'mime' => $_SERVER['HTTP_ACCEPT'], - 'encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'], - 'charset' => $_SERVER['HTTP_ACCEPT_CHARSET'], + 'ip' => $_SERVER['REMOTE_ADDR'], + 'host' => (isset($_SERVER['REMOTE_ADDR']) ? gethostbyaddr($_SERVER['REMOTE_ADDR']) : ""), + 'port' => $_SERVER['REMOTE_PORT'], + 'ua' => $_SERVER['HTTP_USER_AGENT'], + 'lang' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], + 'mime' => $_SERVER['HTTP_ACCEPT'], + 'encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'], + 'charset' => $_SERVER['HTTP_ACCEPT_CHARSET'], 'connection' => $_SERVER['HTTP_CONNECTION'], - 'cache' => $_SERVER['HTTP_CACHE_CONTROL'], - 'cookie' => $_SERVER['HTTP_COOKIE'], - 'referer' => $_SERVER['HTTP_REFERER'], - 'real_ip' => $_SERVER['HTTP_X_REAL_IP'], - 'fwd_ip' => $_SERVER['HTTP_X_FORWARDED_FOR'], - 'fwd_host' => (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']) : ""), - 'dnt' => $_SERVER['HTTP_DNT'] + 'cache' => $_SERVER['HTTP_CACHE_CONTROL'], + 'cookie' => $_SERVER['HTTP_COOKIE'], + 'referer' => $_SERVER['HTTP_REFERER'], + 'real_ip' => $_SERVER['HTTP_X_REAL_IP'], + 'fwd_ip' => $_SERVER['HTTP_X_FORWARDED_FOR'], + 'fwd_host' => (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']) : ""), + 'dnt' => $_SERVER['HTTP_DNT'] ); // Check request (ex. ifconfig.php?q=ip) @@ -56,64 +36,67 @@ elseif (isset($query) && (($query=="text") || ($query=="all"))) { echo $key.": ".$value."\n"; } die(); - } elseif (isset($query) && ($query=="xml")) { header('Content-Type: text/xml'); - -// Function for SimpleXML creation -function array_to_xml(array $arr, SimpleXMLElement $xml) -{ - foreach ($arr as $k => $v) { - is_array($v) - ? array_to_xml($v, $xml->addChild($k)) - : $xml->addChild($k, $v); - } - return $xml; -} -echo array_to_xml($user, new SimpleXMLElement(''))->asXML(); - + // Function for SimpleXML creation + function array_to_xml(array $arr, SimpleXMLElement $xml) + { + foreach ($arr as $k => $v) { + is_array($v) + ? array_to_xml($v, $xml->addChild($k)) + : $xml->addChild($k, $v); + } + return $xml; + } + echo array_to_xml($user, new SimpleXMLElement(''))->asXML(); } elseif (isset($query) && ($query=="json")) { header('Content-Type: application/json'); die(json_encode($user)); - } else { header('Content-Type: text/html'); -?> - - - - info - - - - - + + + + {$site_title} + + + + + +
+ EOD; + foreach($user as $key => $value) { echo '

'.$key.': '.$value.'

'."\n"; } -?> -
-

Copyright © 2014 Sergey Briskin.
-Get Source code on GitHub

- - - +

Copyright © {$date} Christian Cleberg.
+ Source Code

+ + + EOD; } die(); ?> -- cgit v1.2.3-70-g09d2