Index: trunk/flowmon-web/index.php =================================================================== --- trunk/flowmon-web/index.php (revision 4) +++ trunk/flowmon-web/index.php (revision 1) @@ -18,4 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Copyright 2004, 2005 Red Hat, Inc. +# +# AUTHOR: Andreas Thienemann # @@ -67,5 +70,5 @@ print(''); } - print(''); + print(''); print(''); print(html_footer()); @@ -74,5 +77,4 @@ // We have selected a probe, present with detailes form to get the chart parameters } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'probe_select') { - print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); print(page_header($title = 'FlowMon Chart Parameters')); @@ -110,26 +112,4 @@ print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); print(page_header($title = 'FlowMon Traffic Chart')); - - // Initialize defaults which might not exist - if (!@array_key_exists('style', $_REQUEST)) { - $_REQUEST['style'] = 'Top Sources'; - } - if (!@array_key_exists('timeframe', $_REQUEST)) { - $_REQUEST['timeframe'] = '3600'; - } - if (@$_REQUEST['rolling'] == 'on') { - $_REQUEST['startdate'] = strftime('%Y-%m-%d', (time() - $_REQUEST['timeframe'])); - $_REQUEST['starttime'] = strftime('%H:%M', (time() - $_REQUEST['timeframe'])); - $_REQUEST['enddate'] = strftime('%Y-%m-%d'); - $_REQUEST['endtime'] = strftime('%H:%M'); - - $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); - $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); - } else { - // Sanitize user input - $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); - $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); - } - print(chartstyle_header($_REQUEST['startdate'], $_REQUEST['starttime'], $_REQUEST['enddate'], $_REQUEST['endtime'])); print('

Statistics

'); @@ -140,16 +120,12 @@ } + // Sanitize user input + $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); + $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); if (!isvalid_probe($_REQUEST['probe'])) { die("Invalid Probe"); } - // Do we want namelookups? - if (@$_REQUEST['nslookup'] == 'on') { - $nslookup = True; - } else { - $nslookup = False; - } - - $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime, $nslookup=$nslookup); + $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime); print(''); @@ -159,3 +135,29 @@ print(html_footer()); +// Rolling chart requested +} else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'rollingchart') { + print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = False, $refresh = 300)); + print(page_header($title = 'FlowMon Rolling Traffic Chart')); + print('
+

Rolling Statistics (updated every 5min)

'); + + // Import the Chart-Plugin + if (array_key_exists($_REQUEST['style'], $chart_styles)) { + require_once('charts/'.$chart_styles[$_REQUEST['style']]); + } + + // Sanitize user input + if (!isvalid_probe($_REQUEST['probe'])) { + die("Invalid Probe"); + } + + $file = chart_prepare($_REQUEST['probe'], False, False, $_REQUEST['timeframe']); + + print(''); + + print('
'); + + print(html_footer()); + + }