Project

General

Profile

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

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

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

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

    
20
	2. Redistributions in binary form must reproduce the above copyright
21
	   notice, this list of conditions and the following disclaimer in the
22
	   documentation and/or other materials provided with the distribution.
23

    
24
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
	POSSIBILITY OF SUCH DAMAGE.
34
*/
35

    
36
require("guiconfig.inc");
37

    
38
if ($_POST['width'])
39
	$width = $_POST['width'];
40
else
41
	$width = "550";
42

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

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

    
56
?>
57
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
58
<html>
59
<head>
60
<title><?=gentitle("Status: Traffic graph");?></title>
61
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
62
<link href="gui.css" rel="stylesheet" type="text/css">
63
</head>
64

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

    
71
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
72
	$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
73
}
74
?>
75
<form name="form1" action="status_graph.php" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999">
76
Interface:
77
<select name="if" class="formfld" onchange="document.form1.submit()">
78
<?php
79
foreach ($ifdescrs as $ifn => $ifd) {
80
	echo "<option value=\"$ifn\"";
81
	if ($ifn == $curif) echo " selected";
82
	echo ">" . htmlspecialchars($ifd) . "</option>\n";
83
}
84
?>
85
</select>
86
</form>
87
<div align="center">
88
<embed 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
<p><form method="post" action="status_graph.php">
92
Graph Width: <input name="width" value="<? echo $width; ?>"> Height: <input name="height" value="<? echo $height; ?>"> <input type="submit" value="Change Graph Size"></p>
93
<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.
94
<?php include("fend.inc"); ?>
95
</body>
96
</html>
(90-90/117)