From e0639d80f6a55c06db8fc73b08ed1edee8a7b5a3 Mon Sep 17 00:00:00 2001 From: Jan Paul Tuecking Date: Fri, 17 Jul 2009 05:30:59 +0200 Subject: [PATCH] Added dns.cgi page to change DNS server adresses on red0 with DHCP. Added icon for that page. --- html/cgi-bin/dns.cgi | 123 ++++++++++++++++++++++++++++++++++ html/html/images/dns_link.png | Bin 0 -> 1176 bytes 2 files changed, 123 insertions(+) create mode 100755 html/cgi-bin/dns.cgi create mode 100644 html/html/images/dns_link.png 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 0000000000000000000000000000000000000000..9bdd1607a63475918d8c40ff0e088c263ffb4b36 GIT binary patch literal 1176 zc-q}k`Crm^9R8>sW?t>CUG2WNcGk9b*mPxU&eUzSc4QOV)m+Uj+tymnEHpt;5kWjS z1%WRJf^x_q*H?t_K+OXtrjVk^RBmPb9eZA{=Xrj4etF*S2br0%KOt^M8~`98{Xl9~ z#1kV-j*W@vwu9ZV5!+svcBC-7AiwZz?imC~$tyU4*qMGR_aq_q5_K=iT9 zLpf4g8jobtKDg~*cNX6>soY&f+0*pyYuEkFtn!Bm@#;^$K#VI zjLog$ev55j*eX<5L{eA-4-y*5YW+Ydnp#gJn+7K_4baf&Kd5?0EH|KVoF1K-C+O-m zjiB+|mewwn)*KFpE9#)N^|06HCy)gi*yx;dm6Q|kWWlP}r_!12cKg*@W)+Sx>zLQV zgENl#5)`dnVjxkNKEGdQupq13<`$NvDq~qSg9@pUm5t>!%(7Y*6;gSY!)uHc@>IG6`BfU!~(K7k^D;S1Q z){ATA3B;Q2o@;LR%Dii-th!ANTkvFI6&`A1Lvqaku0?QbX?bMQS=|89*fR6bZ|5l#@i`j7{E{ zu+3693cXvx{yLPWdwg?wyWn_o{CjhBt z8!=L9Jv}ugr)Uf;fuu0dgMwV@r5}#{)%@vKF?w*XLSabr{2-;Ln+uYdZe z@bmiinzOfk_@@+f9{EiGjz6i9@04wg=71fqBTi%YZ>ZZsiQ4)Z3Ecm-Wc%}?hP_v| zr99U1Ea3fIU3v#&({~T3eq;(C2SvptZSgVB@MCvp9*$;#3}n(12a~%tR3^Ui#rsD= zR9e!*XAUI9ftOMr`f?ZO$+_@uYkcgM?DJQ%-uM{gm3KUPlDLU>>aB0SSE2#;DU6n# z90?~zJ-F{x@T-_`_nyly=D&6h_sg9xfP3(NRMo1V{@|VNi;DMjK>u>Zn~y->KKBXz eUh)ZjbUg5%Kb(J5y@wsS1V~TINagH1Ui=^N`w43R literal 0 Hc-jL100001 -- 2.39.2