\n"; foreach ($iface_list as $if) { if ($iface == $if) { print "
  • "; } else { print "
  • "; } print ""; if (isset($iface_title[$if])) { print $iface_title[$if]; } else { print $if; } print ""; print "
  • \n"; } print "\n"; } function kbytes_to_string($kb) { $units = array('TB','GB','MB','KB'); $scale = 1024*1024*1024; $ui = 0; while (($kb < $scale) && ($scale > 1)) { $ui++; $scale = $scale / 1024; } return sprintf("%0.2f %s", ($kb/$scale),$units[$ui]); } function write_summary() { global $summary,$top,$day,$hour,$month; $trx = $summary['totalrx']*1024+$summary['totalrxk']; $ttx = $summary['totaltx']*1024+$summary['totaltxk']; // // build array for write_data_table // $sum[0]['act'] = 1; $sum[0]['label'] = T('This hour'); $sum[0]['rx'] = $hour[0]['rx']; $sum[0]['tx'] = $hour[0]['tx']; $sum[1]['act'] = 1; $sum[1]['label'] = T('This day'); $sum[1]['rx'] = $day[0]['rx']; $sum[1]['tx'] = $day[0]['tx']; $sum[2]['act'] = 1; $sum[2]['label'] = T('This month'); $sum[2]['rx'] = $month[0]['rx']; $sum[2]['tx'] = $month[0]['tx']; $sum[3]['act'] = 1; $sum[3]['label'] = T('All time'); $sum[3]['rx'] = $trx; $sum[3]['tx'] = $ttx; write_data_table(T('Summary'), $sum); print "
    \n"; write_data_table(T('Top 10 days'), $top); } function write_data_table($caption, $tab) { print "\n"; print "\n"; print ""; print ""; print ""; print ""; print ""; print "\n"; for ($i=0; $i"; print ""; print ""; print ""; print ""; print "\n"; } } print "
    $caption
     ".T('In')."".T('Out')."".T('Total')."
    $t$rx$tx$total
    \n"; } get_vnstat_data(); // // html start // header('Content-type: text/html; charset=utf-8'); print ''; ?> vnStat - PHP frontend
    \n"; } else { print "\"graph\"/\n"; } if ($page == 's') { write_summary(); } else if ($page == 'h') { write_data_table(T('Last 24 hours'), $hour); } else if ($page == 'd') { write_data_table(T('Last 30 days'), $day); } else if ($page == 'm') { write_data_table(T('Last 12 months'), $month); } ?>