summaryrefslogtreecommitdiffstats
path: root/usr/local/www/bandwidth_by_ip.php
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www/bandwidth_by_ip.php')
-rwxr-xr-xusr/local/www/bandwidth_by_ip.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php
index 979cffb..f14af21 100755
--- a/usr/local/www/bandwidth_by_ip.php
+++ b/usr/local/www/bandwidth_by_ip.php
@@ -65,19 +65,22 @@ for ($x=2; $x<12; $x++){
$emptyinfocounter = 1;
if ($bandwidthinfo != "") {
$infoarray = explode (":",$bandwidthinfo);
- if ($hostipformat == "hostname") {
+ if ($hostipformat == "") {
+ $addrdata = $infoarray[0];
+ } else {
+ // $hostipformat is "hostname" or "fqdn"
$addrdata = gethostbyaddr($infoarray[0]);
if ($addrdata == $infoarray[0]) {
// gethostbyaddr() gave us back the IP address, so try the static mapping array
if ($iplookup[$infoarray[0]] != "")
$addrdata = $iplookup[$infoarray[0]];
} else {
- // gethostbyaddr() gave an answer. Just pass back the name up to the first "."
- $name_array = explode(".", $addrdata);
- $addrdata = $name_array[0];
+ if ($hostipformat == "hostname") {
+ // Only pass back the first part of the name, not the FQDN.
+ $name_array = explode(".", $addrdata);
+ $addrdata = $name_array[0];
+ }
}
- } else {
- $addrdata = $infoarray[0];
}
//print host information;
echo $addrdata . ";" . $infoarray[1] . ";" . $infoarray[2] . "|";
OpenPOWER on IntegriCloud