Changeset 4 for trunk/flowmon-web/index.php
- Timestamp:
- 12/05/08 10:18:51 (16 years ago)
- Files:
-
- trunk/flowmon-web/index.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/flowmon-web/index.php
r1 r4 18 18 # along with this program; if not, write to the Free Software 19 19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 # Copyright 2004, 2005 Red Hat, Inc.21 #22 # AUTHOR: Andreas Thienemann <athienem@redhat.com>23 20 # 24 21 … … 70 67 print('<option value="'.$probe.'">'.$hostname.' ('.$probe.')</option>'); 71 68 } 72 print('</select><input type="hidden" name="action" value=" probe_select"><input type="submit" value="Graph!"></form>');69 print('</select><input type="hidden" name="action" value="chart"><input type="hidden" name="nslookup" value="on"><input type="hidden" name="rolling" value="on"><input type="submit" value="Graph!"></form>'); 73 70 print('</div>'); 74 71 print(html_footer()); … … 77 74 // We have selected a probe, present with detailes form to get the chart parameters 78 75 } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'probe_select') { 76 79 77 print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); 80 78 print(page_header($title = 'FlowMon Chart Parameters')); … … 112 110 print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); 113 111 print(page_header($title = 'FlowMon Traffic Chart')); 112 113 // Initialize defaults which might not exist 114 if (!@array_key_exists('style', $_REQUEST)) { 115 $_REQUEST['style'] = 'Top Sources'; 116 } 117 if (!@array_key_exists('timeframe', $_REQUEST)) { 118 $_REQUEST['timeframe'] = '3600'; 119 } 120 if (@$_REQUEST['rolling'] == 'on') { 121 $_REQUEST['startdate'] = strftime('%Y-%m-%d', (time() - $_REQUEST['timeframe'])); 122 $_REQUEST['starttime'] = strftime('%H:%M', (time() - $_REQUEST['timeframe'])); 123 $_REQUEST['enddate'] = strftime('%Y-%m-%d'); 124 $_REQUEST['endtime'] = strftime('%H:%M'); 125 126 $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); 127 $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); 128 } else { 129 // Sanitize user input 130 $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); 131 $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); 132 } 133 print(chartstyle_header($_REQUEST['startdate'], $_REQUEST['starttime'], $_REQUEST['enddate'], $_REQUEST['endtime'])); 114 134 print('<div style="margin: 30px auto 30px auto; width: 850px; text-align: left;"> 115 135 <h1> Statistics</h1>'); … … 120 140 } 121 141 122 // Sanitize user input123 $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']);124 $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']);125 142 if (!isvalid_probe($_REQUEST['probe'])) { 126 143 die("Invalid Probe"); 127 144 } 128 145 129 $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime); 146 // Do we want namelookups? 147 if (@$_REQUEST['nslookup'] == 'on') { 148 $nslookup = True; 149 } else { 150 $nslookup = False; 151 } 152 153 $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime, $nslookup=$nslookup); 130 154 131 155 print('<img src="'.$file.'" />'); … … 135 159 print(html_footer()); 136 160 137 // Rolling chart requested138 } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'rollingchart') {139 print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = False, $refresh = 300));140 print(page_header($title = 'FlowMon Rolling Traffic Chart'));141 print('<div style="margin: 30px auto 30px auto; width: 850px; text-align: left;">142 <h1>Rolling Statistics (updated every 5min)</h1>');143 144 // Import the Chart-Plugin145 if (array_key_exists($_REQUEST['style'], $chart_styles)) {146 require_once('charts/'.$chart_styles[$_REQUEST['style']]);147 }148 149 // Sanitize user input150 if (!isvalid_probe($_REQUEST['probe'])) {151 die("Invalid Probe");152 }153 154 $file = chart_prepare($_REQUEST['probe'], False, False, $_REQUEST['timeframe']);155 156 print('<img src="'.$file.'" />');157 158 print(' </div>');159 160 print(html_footer());161 162 163 161 }