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