]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/mac.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
33 my $errormessage = '';
35 &Header
::showhttpheaders
();
37 &General
::readhash
("${General::swroot}/mac/settings", \
%macsettings);
39 &Header
::getcgihash
(\
%macsettings);
41 &Header
::openpage
($Lang::tr
{'mac address title'}, 1, );
43 &Header
::openbigbox
('100%', 'left', '', $errormessage);
45 if ($macsettings{'ACTION'} eq $Lang::tr
{'save'}) {
46 $macsettings{'MAC'} =~ s/\-/:/g;
47 my @mac = split(/:/,$macsettings{"MAC"});
49 if (($mac[0] eq "00")||($mac[0] eq "0")){
51 unless ($_ =~ /^[a-fA-F0-9]{1,2}$/) {
52 $errormessage = $Lang::tr
{'mac address error not valid'};
57 $errormessage = $Lang::tr
{'mac address error not 00'};
59 if ($errormessage eq "") {
60 $macsettings{'MAC'} =~ s/\:/-/g;
61 &General
::writehash
("${General::swroot}/mac/settings", \
%macsettings);
62 &Header
::openbox
('100%', 'left', $Lang::tr
{'mac address saved'});
63 print "<font class='base'>$Lang::tr{'mac address saved txt'}</font>\n";
67 $errormessage = $Lang::tr
{'mac address error not valid'};
70 if ($macsettings{'RECONNECT'} eq $Lang::tr
{'reconnect'}) {
71 system("/usr/local/bin/redctrl restart >/dev/null 2>&1 &");
72 &Header
::openbox
('100%', 'left', $Lang::tr
{'mac address recon'} );
73 print "<font class='base'>$Lang::tr{'mac address done'}</font>\n";
77 # DPC move error message to top so it is seen!
79 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
80 print "<font class='base'>$errormessage </font>\n";
84 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
86 &Header
::openbox
('100%', 'left', $Lang::tr
{'mac address header'});
89 <table border="0" width='100%'>
91 <td><font class='base'>$Lang::tr{'mac desc'}</font></td>
97 <td><font class='base'>$Lang::tr{'mac new'} </font>
98 <input type="text" name="MAC" maxlength="17" value='$macsettings{"MAC"}'/></td>
104 <td><div align="center">
105 <input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
106
107 <input type='submit' name='RECONNECT' value='$Lang::tr{'reconnect'}' />
119 &Header
::closebigbox
();
121 &Header
::closepage
();