"Fossies" - the Fresh Open Source Software Archive

Member "bandwidthd-2.0.1/phphtdocs/details.php" (7 Jan 2005, 4299 Bytes) of package /linux/privat/old/bandwidthd-2.0.1.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "details.php" see the Fossies "Dox" file reference documentation.

    1 <?include("include.php");?>
    2 <html>
    3 <center>
    4 <img src=logo.gif>
    5 <?
    6 if (isset($_GET['sensor_name']))
    7     $sensor_name = $_GET['sensor_name'];
    8 else
    9     {
   10     echo "<br>Please provide a sensor_name";
   11     exit(1);
   12     }
   13 
   14 if (isset($_GET['ip']))
   15     $ip = $_GET['ip'];
   16 else
   17     {
   18     echo "<br>Please provide an ip address";
   19     exit(1);
   20     }
   21                                                                                                                              
   22 echo "<h3>";
   23 if (strpos($ip, "/") === FALSE)
   24     echo "$ip - ".gethostbyaddr($ip)."</h3>";
   25 else
   26     echo "Total - $ip</h3>";
   27 
   28 $db = ConnectDb();
   29 
   30 if ($ip == "0.0.0.0/0")
   31     {
   32     $rxtable = "bd_rx_total_log";
   33     $txtable = "bd_tx_total_log";
   34     }
   35 else
   36     {
   37     $rxtable = "bd_rx_log";
   38     $txtable = "bd_tx_log";
   39     }
   40 
   41 $sql = "select rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent,
   42 rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp,
   43 tx.icmp+rx.icmp as icmp, tx.http+rx.http as http,
   44 tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp
   45 from
   46                                                                                                                              
   47 (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,
   48 sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp
   49 from sensors, $txtable
   50 where sensor_name = '$sensor_name'
   51 and sensors.sensor_id = ".$txtable.".sensor_id
   52 and ip <<= '$ip'
   53 group by ip) as tx,
   54                                                                                                                              
   55 (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,
   56 sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp
   57 from sensors, $rxtable
   58 where sensor_name = '$sensor_name'
   59 and sensors.sensor_id = ".$rxtable.".sensor_id
   60 and ip <<= '$ip'
   61 group by ip) as rx
   62                                                                                                                              
   63 where tx.ip = rx.ip;";
   64 //echo "</center><pre>$sql</pre><center>";exit(0);
   65 $result = pg_query($sql);
   66 echo "<table width=100% border=1 cellspacing=0><tr><td>Ip<td>Name<td>Total<td>Sent<td>Received<td>tcp<td>udp<td>icmp<td>http<td>p2p<td>ftp";
   67 $r = pg_fetch_array($result);
   68 echo "<tr><td>";
   69 if (strpos($ip, "/") === FALSE)
   70     echo "$ip<td>".gethostbyaddr($ip);
   71 else
   72     echo "Total<td>$ip";
   73 echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']).
   74     fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']).
   75     fmtb($r['p2p']).fmtb($r['ftp']);
   76 echo "</table></center>";
   77 
   78 echo "<center><h4>Daily</h4></center>";
   79 echo "Send:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   80 echo "<img src=legend.gif><br>";
   81 echo "Receive:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   82 echo "<img src=legend.gif><br>";
   83 
   84 echo "<center><h4>Weekly</h4></center>";
   85 echo "Send:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   86 echo "<img src=legend.gif><br>";
   87 echo "Receive:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   88 echo "<img src=legend.gif><br>";
   89 
   90 echo "<center><h4>Monthly</h4></center>";
   91 echo "Send:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   92 echo "<img src=legend.gif><br>";
   93 echo "Receive:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   94 echo "<img src=legend.gif><br>";
   95 
   96 echo "<center><h4>Yearly</h4></center>";
   97 echo "Send:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
   98 echo "<img src=legend.gif><br>";
   99 echo "Receive:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
  100 echo "<img src=legend.gif><br>";