'.$interfacename.' Statistics Summary | ||||||||
';
echo '
| ||||||||
';
echo ' ';
//echo ' ';
echo ' ';
echo '
|
'; include("fbegin.inc"); echo '
ifBWStats: Monthly Statistics
'; //find all valid data files for active and inactive interfaces //assume monitoring all interfaces $datafilestores = array(); $n=0; //if only monitoring one inteface if ($config['installedpackages']['ifbwstats']['config'][0]['ifmon'] != 'all') { //dont check conf directory, as if only one interface is being monitored, it must be used and therefore in the tmp dir if (file_exists('/tmp/ifbwstats-'.$config['installedpackages']['ifbwstats']['config'][0]['ifmon'].'.data')) { $datafilestores[$n] = '/tmp/ifbwstats-'.$config['installedpackages']['ifbwstats']['config'][0]['ifmon'].'.data'; cleanup_data_file ($datafilestores[$n], $datafilestores[$n]); $n++; } } else { if ($handle = opendir('/tmp')) { while (false !== ($file = readdir($handle))) { if ((preg_match ("/ifbwstats/", $file))&&(preg_match ("/.data/", $file))) { $datafilestores[$n] = '/tmp/'.$file; cleanup_data_file ($datafilestores[$n], $datafilestores[$n]); $n++; } } } if ($handle = opendir('/cf/conf')) { while (false !== ($file = readdir($handle))) { $filefound = 'no'; if ((preg_match ("/ifbwstats-/", $file))&&(preg_match ("/.data/", $file))) { for ($i = 0; $i < $n; $i++) if (preg_match ("/$file/", $datafilestores[$i])) $filefound = 'yes'; if ($filefound == 'no') { cleanup_data_file ('/cf/conf/'.$file, '/tmp/'.$file); $datafilestores[$n] = '/tmp/'.$file; $n++; } } } } } //display tabs echo ''; $tab_array[0] = array ("Daily", false, "ifbwstats_cur.php"); $tab_array[1] = array ("Monthly", true, "ifbwstats_disp.php"); $tab_array[2] = array ("Settings", false, "pkg_edit.php?xml=ifbwstats.xml"); display_top_tabs($tab_array); echo ' | ||||||||||||||||
';
//cycle through all valid data files found
foreach ($datafilestores as $wandataallfile)
{
//----------------------------------------begin file statistics monthly display----------------------------------------
//read data file
$fp = fopen($wandataallfile,"r") or die("Error Reading File");
$data = fread($fp, filesize($wandataallfile));
fclose($fp);
$wandataall = explode("\n", $data);
$n = count($wandataall);
$monthintotal = 0;
$monthouttotal = 0;
$monthdaystart = 0;
$interfacename = str_replace('.data', '', $wandataallfile);
$interfacename = str_replace('/tmp/ifbwstats-', '', $interfacename);
$interfacename = str_replace('/cf/conf/ifbwstats-', '', $interfacename);
echo ' ';
echo ' ';
unset ($writedata);
//----------------------------------------end file statistics monthly display----------------------------------------
}
//end foreach loop
echo '
|