Revision 9573d170
Added by Scott Ullrich over 20 years ago
usr/local/www/status_graph.php | ||
---|---|---|
1 | 1 |
#!/usr/local/bin/php |
2 |
<?php
|
|
2 |
<?php |
|
3 | 3 |
/* |
4 | 4 |
status_graph.php |
5 | 5 |
part of m0n0wall (http://m0n0.ch/wall) |
6 |
|
|
6 |
|
|
7 | 7 |
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. |
8 | 8 |
All rights reserved. |
9 |
|
|
9 |
|
|
10 | 10 |
Redistribution and use in source and binary forms, with or without |
11 | 11 |
modification, are permitted provided that the following conditions are met: |
12 |
|
|
12 |
|
|
13 | 13 |
1. Redistributions of source code must retain the above copyright notice, |
14 | 14 |
this list of conditions and the following disclaimer. |
15 |
|
|
15 |
|
|
16 | 16 |
2. Redistributions in binary form must reproduce the above copyright |
17 | 17 |
notice, this list of conditions and the following disclaimer in the |
18 | 18 |
documentation and/or other materials provided with the distribution. |
19 |
|
|
19 |
|
|
20 | 20 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
21 | 21 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
22 | 22 |
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
... | ... | |
31 | 31 |
|
32 | 32 |
require("guiconfig.inc"); |
33 | 33 |
|
34 |
if ($_POST['width']) |
|
35 |
$width = $_POST['width']; |
|
36 |
else |
|
37 |
$width = "550"; |
|
38 |
|
|
39 |
if ($_POST['y']) |
|
40 |
$height = $_POST['height']; |
|
41 |
else |
|
42 |
$height = "275"; |
|
43 |
|
|
34 | 44 |
$curif = "wan"; |
35 | 45 |
if ($_GET['if']) |
36 | 46 |
$curif = $_GET['if']; |
37 |
|
|
47 |
|
|
38 | 48 |
if ($curif == "wan") |
39 | 49 |
$ifnum = get_real_wan_interface(); |
40 | 50 |
else |
... | ... | |
53 | 63 |
<p class="pgtitle">Status: Traffic graph</p> |
54 | 64 |
<?php |
55 | 65 |
$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN'); |
56 |
|
|
66 |
|
|
57 | 67 |
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { |
58 | 68 |
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; |
59 | 69 |
} |
60 | 70 |
?> |
61 | 71 |
<form name="form1" action="" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999"> |
62 |
Interface:
|
|
72 |
Interface: |
|
63 | 73 |
<select name="if" class="formfld" onchange="document.form1.submit()"> |
64 | 74 |
<?php |
65 | 75 |
foreach ($ifdescrs as $ifn => $ifd) { |
... | ... | |
72 | 82 |
</form> |
73 | 83 |
<div align="center"> |
74 | 84 |
<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" />
|
|
85 |
width="<? echo $width; ?>" height="<? echo $height; ?>" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
|
|
76 | 86 |
</div> |
77 | 87 |
<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. |
88 |
<p><form method="post" action="status_graph.php"> |
|
89 |
Graph Width: <input name="width" value="<? echo $width; ?>"> Height: <input name="height" value="<? echo $height; ?>"> <input type="submit" value="Change Graph Size"></p> |
|
78 | 90 |
<?php include("fend.inc"); ?> |
79 | 91 |
</body> |
80 | 92 |
</html> |
Also available in: Unified diff
Custom graph width / height settings now inputtable by user.
Idea from:
http://m0n0.ch/wall/gallery/stefan_zier/monowall-pic.jpg