Index: trunk/flowmon-web/index.php =================================================================== --- trunk/flowmon-web/index.php (revision 1) +++ trunk/flowmon-web/index.php (revision 4) @@ -18,7 +18,4 @@ # 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 # @@ -70,5 +67,5 @@ print(''); } - print(''); + print(''); print(''); print(html_footer()); @@ -77,4 +74,5 @@ // 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')); @@ -112,4 +110,26 @@ 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

'); @@ -120,12 +140,16 @@ } - // Sanitize user input - $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); - $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); if (!isvalid_probe($_REQUEST['probe'])) { die("Invalid Probe"); } - $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime); + // Do we want namelookups? + if (@$_REQUEST['nslookup'] == 'on') { + $nslookup = True; + } else { + $nslookup = False; + } + + $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime, $nslookup=$nslookup); print(''); @@ -135,29 +159,3 @@ 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()); - - }