]>
Commit | Line | Data |
---|---|---|
d81292e0 CS |
1 | #!/usr/bin/perl |
2 | # | |
3 | # This code is distributed under the terms of the GPL | |
4 | # | |
5 | # Copyright (c) 2005 Achim Weber | |
6 | # | |
7 | # $Id: trafficadm.cgi,v 1.21 2006/12/31 14:33:18 dotzball Exp $ | |
8 | # | |
9 | ||
10 | use strict; | |
11 | ||
12 | # enable only the following on debugging purpose | |
13 | use warnings; | |
14 | use CGI::Carp 'fatalsToBrowser'; | |
15 | ||
16 | require '/var/ipfire/general-functions.pl'; | |
17 | require "${General::swroot}/lang.pl"; | |
18 | require "${General::swroot}/header.pl"; | |
19 | require "${General::swroot}/net-traffic/net-traffic-admin.pl"; | |
20 | ||
21 | my %cgiparams; | |
22 | my $errormessage = ''; | |
23 | my $infomessage = ''; | |
24 | my $saveerror = 0; | |
25 | my @days = ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 ); | |
26 | my @warnLevels = ( 50,60,70,80,90,100 ); | |
27 | ||
28 | my @dummy = ($NETTRAFF::settingsfile, ${Header::colourred}); | |
29 | undef(@dummy); | |
30 | ||
31 | &Header::showhttpheaders(); | |
32 | ||
33 | # Init parameters | |
34 | $cgiparams{'MONTHLY_VOLUME_ON'} = 'off'; | |
35 | $cgiparams{'MONTHLY_VOLUME'} = ''; | |
36 | $cgiparams{'STARTDAY'} = '1'; | |
37 | $cgiparams{'WARN_ON'} = 'off'; | |
38 | $cgiparams{'WARN'} = '80'; | |
39 | $cgiparams{'CALC_INTERVAL'} = '60'; | |
40 | $cgiparams{'SHOW_AT_HOME'} = 'off'; | |
41 | $cgiparams{'SEND_EMAIL_ON'} = 'off'; | |
42 | $cgiparams{'EMAIL_TO'} = ''; | |
43 | $cgiparams{'EMAIL_FROM'} = ''; | |
44 | $cgiparams{'EMAIL_USR'} = ''; | |
45 | $cgiparams{'EMAIL_PW'} = ''; | |
46 | $cgiparams{'EMAIL_SERVER'} = ''; | |
47 | $cgiparams{'VERSION_CHECK_ON'} = 'off'; | |
48 | ||
49 | ||
50 | &Header::getcgihash(\%cgiparams); | |
51 | ||
52 | if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) | |
53 | { | |
54 | &validSave(); | |
55 | ||
56 | if ($errormessage) { | |
57 | $saveerror = 1; | |
58 | } | |
59 | else { # no error, all right, save new settings | |
60 | &General::writehash($NETTRAFF::settingsfile, \%cgiparams); | |
61 | # calculate traffic | |
62 | `/usr/local/bin/monitorTraff --force < /dev/null > /dev/null 2>&1 &`; | |
63 | } | |
64 | } # end if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) | |
65 | ||
66 | ||
67 |