diff options
author | Phil Davis <phil.davis@world.inf.org> | 2013-03-07 09:04:58 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2013-03-07 09:04:58 +0545 |
commit | 232d38abe671158447d800206f27f4f8e508155f (patch) | |
tree | 7bab9280893fe5451c0d1a0fd89dfcf6cd9fd75d /usr/local/www/bandwidth_by_ip.php | |
parent | c16f7c5c983a23839d42e00b250da81689848f51 (diff) | |
download | pfsense-232d38abe671158447d800206f27f4f8e508155f.zip pfsense-232d38abe671158447d800206f27f4f8e508155f.tar.gz |
Traffic Graph add option to display FQDN
It was easy to give the user the choice of displaying IP Address, just the Host Name or the FQDN. And the display wraps long FQDNs OK.
Diffstat (limited to 'usr/local/www/bandwidth_by_ip.php')
-rwxr-xr-x | usr/local/www/bandwidth_by_ip.php | 15 |
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] . "|"; |