Please provide a sensor_name"; exit(1); } if (isset($_GET['ip'])) $ip = $_GET['ip']; else { echo "
Please provide an ip address"; exit(1); } echo "

"; if (strpos($ip, "/") === FALSE) echo "$ip - ".gethostbyaddr($ip)."

"; else echo "Total - $ip"; $db = ConnectDb(); if ($ip == "0.0.0.0/0") { $rxtable = "bd_rx_total_log"; $txtable = "bd_tx_total_log"; } else { $rxtable = "bd_rx_log"; $txtable = "bd_tx_log"; } $sql = "select rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp from (SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp from sensors, $txtable where sensor_name = '$sensor_name' and sensors.sensor_id = ".$txtable.".sensor_id and ip <<= '$ip' group by ip) as tx, (SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp from sensors, $rxtable where sensor_name = '$sensor_name' and sensors.sensor_id = ".$rxtable.".sensor_id and ip <<= '$ip' group by ip) as rx where tx.ip = rx.ip;"; //echo "
$sql
";exit(0); $result = pg_query($sql); echo "
IpNameTotalSentReceivedtcpudpicmphttpp2pftp"; $r = pg_fetch_array($result); echo "
"; if (strpos($ip, "/") === FALSE) echo "$ip".gethostbyaddr($ip); else echo "Total$ip"; 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']); echo "
"; echo "

Daily

"; echo "Send:

"; echo "
"; echo "Receive:

"; echo "
"; echo "

Weekly

"; echo "Send:

"; echo "
"; echo "Receive:

"; echo "
"; echo "

Monthly

"; echo "Send:

"; echo "
"; echo "Receive:

"; echo "
"; echo "

Yearly

"; echo "Send:

"; echo "
"; echo "Receive:

"; echo "
";