Commit 30bcea7a11
Unsigned
Layout: unified · split
ifconfig.php +5 −6
| @@ -2,7 +2,6 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | * User connection info |
| 4 | 4 | * |
| 5 | * Version: 1.1 2014/03/08 | |
| 6 | 5 | * License: GPL v2 (https://www.gnu.org/licenses/gpl-2.0.html) |
| 7 | 6 | * |
| 8 | 7 | * Copyright (C) 2014 Sergey Briskin (http://briskin.org) |
| @@ -47,11 +46,11 @@ $user = array( | ||
| 47 | 46 | $query=trim(preg_replace('/ +/', ' ', preg_replace('/[^A-Za-z0-9 ]/', ' ', urldecode(html_entity_decode(strip_tags($_GET['q'])))))); |
| 48 | 47 | |
| 49 | 48 | // Return single value on request & die |
| 50 | if (isset($query) && !empty($user[$query]) && array_key_exists($query, $user)) { | |
| 51 | die($user[$query]."\n"); | |
| 49 | if (isset($query) && array_key_exists($query, $user)) { | |
| 50 | empty($user[$query]) ? die() : die($user[$query]."\n"); | |
| 52 | 51 | } |
| 53 | 52 | // Return full output in one of supported formats (html, text, xml, json. default: html) |
| 54 | elseif (isset($query) && ($query=="text")) { | |
| 53 | elseif (isset($query) && (($query=="text") || ($query=="all"))) { | |
| 55 | 54 | header('Content-Type: text/plain'); |
| 56 | 55 | foreach($user as $key => $value) { |
| 57 | 56 | echo $key.": ".$value."\n"; |
| @@ -106,7 +105,7 @@ echo array_to_xml($user, new SimpleXMLElement('<info/>'))->asXML(); | ||
| 106 | 105 | <body> |
| 107 | 106 | <? |
| 108 | 107 | foreach($user as $key => $value) { |
| 109 | echo ' <p id='.$key.'>'.$key.': '.$value.'</p>'."\n"; | |
| 108 | echo ' <p id="'.$key.'">'.$key.': '.$value.'</p>'."\n"; | |
| 110 | 109 | } |
| 111 | 110 | ?> |
| 112 | 111 | <br/> |
| @@ -117,4 +116,4 @@ echo array_to_xml($user, new SimpleXMLElement('<info/>'))->asXML(); | ||
| 117 | 116 | <? |
| 118 | 117 | } |
| 119 | 118 | die(); |
| 120 | ?> | |
| \ No newline at end of file | ||
| 119 | ?> | |