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