1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
|
|
<?php
|
3 |
|
|
/*
|
4 |
|
|
status_graph.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
|
|
|
7 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
|
|
|
10 |
|
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
|
|
|
13 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
|
|
|
16 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
|
|
|
20 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
|
|
require("guiconfig.inc");
|
33 |
|
|
|
34 |
|
|
$curif = "wan";
|
35 |
|
|
if ($_GET['if'])
|
36 |
|
|
$curif = $_GET['if'];
|
37 |
|
|
|
38 |
|
|
if ($curif == "wan")
|
39 |
|
|
$ifnum = get_real_wan_interface();
|
40 |
|
|
else
|
41 |
|
|
$ifnum = $config['interfaces'][$curif]['if'];
|
42 |
|
|
?>
|
43 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
44 |
|
|
<html>
|
45 |
|
|
<head>
|
46 |
|
|
<title><?=gentitle("Status: Traffic graph");?></title>
|
47 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
48 |
|
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
49 |
|
|
</head>
|
50 |
|
|
|
51 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
52 |
|
|
<?php include("fbegin.inc"); ?>
|
53 |
|
|
<p class="pgtitle">Status: Traffic graph</p>
|
54 |
|
|
<?php
|
55 |
|
|
$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
|
56 |
|
|
|
57 |
|
|
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
|
58 |
|
|
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
|
59 |
|
|
}
|
60 |
|
|
?>
|
61 |
|
|
<form name="form1" action="" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999">
|
62 |
|
|
Interface:
|
63 |
|
|
<select name="if" class="formfld" onchange="document.form1.submit()">
|
64 |
|
|
<?php
|
65 |
|
|
foreach ($ifdescrs as $ifn => $ifd) {
|
66 |
|
|
echo "<option value=\"$ifn\"";
|
67 |
|
|
if ($ifn == $curif) echo " selected";
|
68 |
|
|
echo ">" . htmlspecialchars($ifd) . "</option>\n";
|
69 |
|
|
}
|
70 |
|
|
?>
|
71 |
|
|
</select>
|
72 |
|
|
</form>
|
73 |
|
|
<div align="center">
|
74 |
|
|
<embed src="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml"
|
75 |
|
|
width="550" height="275" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
|
76 |
|
|
</div>
|
77 |
|
|
<p><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG viewer</a> is required to view the graph.
|
78 |
|
|
<?php include("fend.inc"); ?>
|
79 |
|
|
</body>
|
80 |
|
|
</html>
|