makegraphs umgebaut, sodass nurnoch rrd daten geschrieben werden die graphen
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / fwhits.cgi
1 #!/usr/bin/perl
2 #
3 # This code is distributed under the terms of the GPL
4 #
5
6 use strict;
7
8 # enable only the following on debugging purpose
9 #use warnings;
10 #use CGI::Carp 'fatalsToBrowser';
11
12 require '/var/ipfire/general-functions.pl';
13 require "${General::swroot}/lang.pl";
14 require "${General::swroot}/header.pl";
15 require "${General::swroot}/graphs.pl";
16
17 my %cgiparams=();
18 my @cgigraphs=();
19 my @graphs=();
20
21 &Graphs::updatefwhitsgraph ("day");
22 &Graphs::updatefwhitsgraph ("week");
23 &Graphs::updatefwhitsgraph ("month");
24 &Graphs::updatefwhitsgraph ("year");
25
26 $ENV{'QUERY_STRING'} =~ s/&//g;
27 @cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
28 $cgigraphs[1] = '' unless defined $cgigraphs[1];
29
30 &Header::showhttpheaders();
31
32 my $graphdir = "/home/httpd/html/graphs";
33 my @LOCALCHECK=();
34 my $errormessage="";
35
36 &Header::openpage($Lang::tr{'firewall graphs'}, 1, '');
37
38 &Header::openbigbox('100%', 'left', '', $errormessage);
39 print <<END;
40 <table width="100%" align="center">
41 <tr>
42 <td align="left">
43 <a href=/cgi-bin/fwhits.cgi?graph=line>$Lang::tr{'show lines'}</a>
44 &nbsp;
45 <a href=/cgi-bin/fwhits.cgi?graph=area>$Lang::tr{'show areas'}</a>
46 </td>
47 </tr>
48 </table>
49 END
50 if ($cgigraphs[1] eq "line") {
51 &Header::openbox('100%', 'center', $Lang::tr{"daily firewallhits"});
52 my $ftime = localtime((stat("$graphdir/firewallhits-day-line.png"))[9]);
53 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
54 print "<img alt='' src='/graphs/firewallhits-day-line.png' border='0' />";
55 print "<br />\n";
56 &Header::closebox();
57
58 &Header::openbox('100%', 'center', $Lang::tr{"weekly firewallhits"});
59 my $ftime = localtime((stat("$graphdir/firewallhits-week-line.png"))[9]);
60 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
61 print "<img alt='' src='/graphs/firewallhits-week-line.png' border='0' />";
62 print "<br />\n";
63 &Header::closebox();
64
65 &Header::openbox('100%', 'center', $Lang::tr{"monthly firewallhits"});
66 my $ftime = localtime((stat("$graphdir/firewallhits-month-line.png"))[9]);
67 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
68 print "<img alt='' src='/graphs/firewallhits-month-line.png' border='0' />";
69 print "<br />\n";
70 &Header::closebox();
71
72 &Header::openbox('100%', 'center', $Lang::tr{"yearly firewallhits"});
73 my $ftime = localtime((stat("$graphdir/firewallhits-year-line.png"))[9]);
74 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
75 print "<img alt='' src='/graphs/firewallhits-year-line.png' border='0' />";
76 print "<br />\n";
77 &Header::closebox();
78 }
79 else
80 {
81 &Header::openbox('100%', 'center', $Lang::tr{"daily firewallhits"});
82 my $ftime = localtime((stat("$graphdir/firewallhits-day-area.png"))[9]);
83 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
84 print "<img alt='' src='/graphs/firewallhits-day-area.png' border='0' />";
85 print "<br />\n";
86 &Header::closebox();
87
88 &Header::openbox('100%', 'center', $Lang::tr{"weekly firewallhits"});
89 my $ftime = localtime((stat("$graphdir/firewallhits-week-area.png"))[9]);
90 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
91 print "<img alt='' src='/graphs/firewallhits-week-area.png' border='0' />";
92 print "<br />\n";
93 &Header::closebox();
94
95 &Header::openbox('100%', 'center', $Lang::tr{"monthly firewallhits"});
96 my $ftime = localtime((stat("$graphdir/firewallhits-month-area.png"))[9]);
97 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
98 print "<img alt='' src='/graphs/firewallhits-month-area.png' border='0' />";
99 print "<br />\n";
100 &Header::closebox();
101
102 &Header::openbox('100%', 'center', $Lang::tr{"yearly firewallhits"});
103 my $ftime = localtime((stat("$graphdir/firewallhits-year-area.png"))[9]);
104 print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
105 print "<img alt='' src='/graphs/firewallhits-year-area.png' border='0' />";
106 print "<br />\n";
107 &Header::closebox();
108 }
109
110
111 &Header::closebigbox();
112 &Header::closepage();