Project

General

Profile

Download (3.42 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2 9573d170 Scott Ullrich
<?php
3 b46bfcf5 Bill Marquette
/* $Id$ */
4 5b237745 Scott Ullrich
/*
5
	status_graph.php
6 6ad24605 Scott Ullrich
	Part of pfSense
7
	Copyright (C) 2004 Scott Ullrich
8
	All rights reserved.
9 9573d170 Scott Ullrich
10 6ad24605 Scott Ullrich
	Originally part of m0n0wall (http://m0n0.ch/wall)
11 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
	All rights reserved.
13 9573d170 Scott Ullrich
14 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
15
	modification, are permitted provided that the following conditions are met:
16 9573d170 Scott Ullrich
17 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
18
	   this list of conditions and the following disclaimer.
19 9573d170 Scott Ullrich
20 5b237745 Scott Ullrich
	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 9573d170 Scott Ullrich
24 5b237745 Scott Ullrich
	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 9573d170 Scott Ullrich
if ($_POST['width'])
39
	$width = $_POST['width'];
40
else
41
	$width = "550";
42
43 dd521ae8 Scott Ullrich
if ($_POST['height'])
44 9573d170 Scott Ullrich
	$height = $_POST['height'];
45
else
46
	$height = "275";
47
48 769cdf3b Bill Marquette
if ($_GET['if']) {
49 5b237745 Scott Ullrich
	$curif = $_GET['if'];
50
	$ifnum = $config['interfaces'][$curif]['if'];
51 769cdf3b Bill Marquette
} else {
52
	$curif = "wan";
53
	$ifnum = get_real_wan_interface();
54
}
55
56 5b237745 Scott Ullrich
?>
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 9573d170 Scott Ullrich
71 5b237745 Scott Ullrich
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
72
	$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
73
}
74
?>
75 60f9e276 Bill Marquette
<form name="form1" action="status_graph.php" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999">
76 9573d170 Scott Ullrich
Interface:
77 5b237745 Scott Ullrich
<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 9573d170 Scott Ullrich
		width="<? echo $width; ?>" height="<? echo $height; ?>" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
90 5b237745 Scott Ullrich
</div>
91 570cdbcf Bill Marquette
<p><form method="post" action="status_graph.php">
92 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>
93 8c1c3773 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> is required to view the graph.
94 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
95
</body>
96
</html>