$sql
Ip | Name | Total | Sent | Received | tcp | udp | icmp | http | p2p | ftp"; if (!isset($subnet)) // Set this now for total graphs $subnet = "0.0.0.0/0"; // Output Total Line echo " |
Total | $subnet"; foreach (array("total", "sent", "received", "tcp", "udp", "icmp", "http", "p2p", "ftp") as $key) { for($Counter=0, $Total = 0; $Counter < pg_num_rows($result); $Counter++) { $r = pg_fetch_array($result, $Counter); $Total += $r[$key]; } echo fmtb($Total); } echo "\n"; // Output Other Lines for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++) { $r = pg_fetch_array($result, $Counter); echo " | |||||||||
"; echo $r['ip']." | ".gethostbyaddr($r['ip']); echo ""; echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). fmtb($r['p2p']).fmtb($r['ftp'])."\n"; } echo " |