Project

General

Profile

Download (3.51 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_graph.php
5
	Part of pfSense
6
	Copyright (C) 2004 Scott Ullrich
7
	All rights reserved.
8

    
9
	Originally part of m0n0wall (http://m0n0.ch/wall)
10
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	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

    
23
	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
if ($_POST['width'])
38
	$width = $_POST['width'];
39
else
40
	$width = "550";
41

    
42
if ($_POST['height'])
43
	$height = $_POST['height'];
44
else
45
	$height = "275";
46

    
47
/* link the ipsec interface magically */
48
$config['interfaces']['ipsec']['if'] = "enc0";
49

    
50
if ($_GET['if']) {
51
	$curif = $_GET['if'];
52
	$ifnum = $config['interfaces'][$curif]['if'];
53
} else {
54
	$curif = "wan";
55
	$ifnum = get_real_wan_interface();
56
}
57

    
58
$pgtitle = "Status: Traffic Graph";
59
include("head.inc");
60

    
61
?>
62

    
63
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
64
<?php include("fbegin.inc"); ?>
65
<p class="pgtitle"><?=$pgtitle?></p>
66
<?php
67
$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
68

    
69
for($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
70
	if(isset($config['interfaces']['opt' . $j]['enable']))
71
		$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
72
}
73
if((isset($config['ipsec']['enable'])) || (isset($config['ipsec']['mobileclients']['enable']))) {
74
	$ifdescrs['ipsec'] = "IPSEC";
75
}
76

    
77
?>
78
<form name="form1" action="status_graph.php" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999">
79
Interface:
80
<select name="if" class="formfld" style="z-index: -10;" onchange="document.form1.submit()">
81
<?php
82
foreach ($ifdescrs as $ifn => $ifd) {
83
	echo "<option value=\"$ifn\"";
84
	if ($ifn == $curif) echo " selected";
85
	echo ">" . htmlspecialchars($ifd) . "</option>\n";
86
}
87
?>
88
</select>
89
</form>
90
<p><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG Viewer</a>, Firefox 1.5 or later or other browser supporting SVG is required to view the graph.
91
<p><form method="post" action="status_graph.php">
92
</form>
93
<p>
94
<div align="center">
95
	<object data="graph.php?ifnum=<?=$ifnum;?>&amp;ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml" width="550" height="275">
96
		<param name="src" value="graph.php?ifnum=<?=$ifnum;?>&amp;ifname=<?=rawurlencode($ifdescrs[$curif]);?>" />
97
		Your browser does not support the type SVG! You need to either use Firefox or download the Adobe SVG plugin.
98
	</object>
99
</div>
100

    
101
<?php include("fend.inc"); ?>
102
</body>
103
</html>
(127-127/175)