function allpackets_func($mainports, $con, $db, $date_from, $date_to)
{
$sql = "SELECT SUM(packets) from flow_table where stamp BETWEEN '".$date_from."' AND '".$date_to."'";
$result = mysql_query($sql,$con);
while($row=mysql_fetch_array($result)){
$allpr = $row['SUM(packets)'];
return $allpr;
echo $allpr;
}
}
function mainports_func($mainports, $con, $db, $date_from, $date_to)
{
foreach($mainports as $mainport){
$sql = "SELECT SUM(bytes) from flow_table where src_port='$mainport' AND stamp BETWEEN '".$date_from."' AND '".$date_to."'";
$result = mysql_query($sql,$con);
while($row=mysql_fetch_array($result)){
if ($row[0] > 0)
{
$mainport_result = $row['SUM(bytes)'];
$main="";
echo $main;
}
else
{
$mainport_result = 0;
$main="";
echo $main;
}
}
}
return $main;
}
function outports_func($mainports, $con, $db, $outports, $date_from, $date_to)
{
$sql = "SELECT SUM(bytes) from flow_table where src_port NOT IN ($outports) AND (stamp BETWEEN '".$date_from."' AND '".$date_to."')";
$result = mysql_query($sql,$con);
while($row=mysql_fetch_array($result)){
$outbr = $row['SUM(bytes)'];
$outb = "";
return $outb;
echo $outb;
}