From: Jan Paul Tuecking Date: Fri, 17 Jul 2009 03:30:59 +0000 (+0200) Subject: Added dns.cgi page to change DNS server adresses on red0 with DHCP. Added icon for... X-Git-Tag: v2.5-core29~26 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=e0639d80f6a55c06db8fc73b08ed1edee8a7b5a3 Added dns.cgi page to change DNS server adresses on red0 with DHCP. Added icon for that page. --- diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi new file mode 100755 index 0000000000..08baf1eb61 --- /dev/null +++ b/html/cgi-bin/dns.cgi @@ -0,0 +1,123 @@ +#!/usr/bin/perl +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +use strict; + +# enable only the following on debugging purpose +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %dnssettings=(); +my $errormessage = ''; + +&Header::showhttpheaders(); + +&General::readhash("${General::swroot}/dns/settings", \%dnssettings); + +&Header::getcgihash(\%dnssettings); + +&Header::openpage($Lang::tr{'dns title'}, 1, ); + +&Header::openbigbox('100%', 'left', '', $errormessage); + +if ($dnssettings{'ACTION'} eq $Lang::tr{'save'}) { + if ((&General::validip($dnssettings{"DNS0"}) == 1)&&(&General::validip($dnssettings{"DNS1"}) == 1)) { + if ($errormessage eq "") { + &General::writehash("${General::swroot}/dns/settings", \%dnssettings); + &Header::openbox('100%', 'left', $Lang::tr{'dns saved'}); + print "$Lang::tr{'dns saved txt'}\n"; + &Header::closebox(); + } + } else { + if ((&General::validip($dnssettings{"DNS0"}) == 0)&&(&General::validip($dnssettings{"DNS1"}) == 1)){ + $errormessage = $Lang::tr{'dns error 0'}; + } + if ((&General::validip($dnssettings{"DNS1"}) == 0)&&(&General::validip($dnssettings{"DNS0"}) == 1)){ + $errormessage = $Lang::tr{'dns error 1'}; + } + if ((&General::validip($dnssettings{"DNS1"}) == 0)&&(&General::validip($dnssettings{"DNS0"}) == 0)){ + $errormessage = $Lang::tr{'dns error 01'}; + } + } +} + +if ($dnssettings{'RECONNECT'} eq $Lang::tr{'dns reconnection'}) { + system("/usr/local/bin/redctrl restart >/dev/null 2>&1 &"); + &Header::openbox('100%', 'left', $Lang::tr{'dns address recon'} ); + print "$Lang::tr{'dns address done'}\n"; + &Header::closebox(); +} + +# DPC move error message to top so it is seen! +if ($errormessage) { + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "$errormessage \n"; + &Header::closebox(); +} + +print "
\n"; + +&Header::openbox('100%', 'left', $Lang::tr{'dns header'}); +print < + + $Lang::tr{'dns desc'}
$Lang::tr{'dns list'}
+ + +   + + + $Lang::tr{'dns new 0'} + + + + $Lang::tr{'dns new 1'} + + + +
+ + +
+ +      + +
+ + + + +END +; + +&Header::closebox(); + +print "\n"; + +&Header::closebigbox(); + +&Header::closepage(); + diff --git a/html/html/images/dns_link.png b/html/html/images/dns_link.png new file mode 100644 index 0000000000..9bdd1607a6 Binary files /dev/null and b/html/html/images/dns_link.png differ