]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - html/cgi-bin/ddns.cgi
GeoIP: update database to 05092012.
[people/teissler/ipfire-2.x.git] / html / cgi-bin / ddns.cgi
CommitLineData
ac1cfefa 1#!/usr/bin/perl
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
38b6ec33 5# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
6# #
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. #
11# #
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. #
16# #
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/>. #
19# #
20###############################################################################
ac1cfefa
MT
21
22use strict;
23
24# enable only the following on debugging purpose
25#use warnings;
26#use CGI::Carp 'fatalsToBrowser';
27
986e08d9 28require '/var/ipfire/general-functions.pl';
ac1cfefa
MT
29require "${General::swroot}/lang.pl";
30require "${General::swroot}/header.pl";
31
32#workaround to suppress a warning when a variable is used only once
33my @dummy = ( ${Header::table2colour}, ${Header::colouryellow} );
34undef (@dummy);
35
36my $ddnsprefix = $Lang::tr{'ddns noip prefix'};
37$ddnsprefix =~ s/%/$General::noipprefix/;
38
f2fdd0c1
CS
39my %color = ();
40my %mainsettings = ();
41&General::readhash("${General::swroot}/main/settings", \%mainsettings);
42&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
43
ac1cfefa
MT
44# Files used
45my $setting = "${General::swroot}/ddns/settings";
46our $datafile = "${General::swroot}/ddns/config";
47
48my %settings=();
49#Settings1
50$settings{'BEHINDROUTER'} = 'RED_IP';
51$settings{'MINIMIZEUPDATES'} = '';
52
53#Settings2 for editing the multi-line list
54#Must not be saved !
55$settings{'HOSTNAME'} = '';
56$settings{'DOMAIN'} = '';
57$settings{'LOGIN'} = '';
58$settings{'PASSWORD'} = '';
59$settings{'PASSWORD2'} = '';
60$settings{'ENABLED'} = '';
61$settings{'PROXY'} = '';
62$settings{'WILDCARDS'} = '';
63$settings{'SERVICE'} = '';
64
65my @nosaved=('HOSTNAME','DOMAIN','LOGIN','PASSWORD','PASSWORD2',
66 'ENABLED','PROXY','WILDCARDS','SERVICE'); # List here ALL setting2 fields. Mandatory
67
68$settings{'ACTION'} = ''; # add/edit/remove
69$settings{'KEY1'} = ''; # point record for ACTION
70$settings{'KEY2'} = ''; # point record for ACTION
71
72my $errormessage = '';
73my $warnmessage = '';
74
75&Header::showhttpheaders();
76
77#Get GUI values
78&Header::getcgihash(\%settings);
79
80# Load multiline data
81our @current = ();
82if (open(FILE, "$datafile")) {
83 @current = <FILE>;
84 close (FILE);
85}
86
87#
88# Check Settings1 first because they are needed before working on @current
89#
90if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
91 # No user input to check. !
92 #unless ($errormessage) { # Everything is ok, save settings
93 $settings{'BEHINDROUTERWAITLOOP'} = '-1'; # init & will update on next setddns.pl call
94 map (delete ($settings{$_}) ,(@nosaved,'ACTION','KEY1','KEY2'));# Must never be saved
95 &General::writehash($setting, \%settings); # Save good settings
96 $settings{'ACTION'} = $Lang::tr{'save'}; # Recreate 'ACTION'
97 map ($settings{$_}= '',(@nosaved,'KEY1','KEY2')); # and reinit var to empty
98 #}
99} else {
100 &General::readhash($setting, \%settings); # Get saved settings and reset to good if needed
101}
102
103#
104# Now manipulate the multi-line list with Settings2
105#
106# Toggle enable/disable field. Field is in second position
107if ($settings{'ACTION'} eq $Lang::tr{'toggle enable disable'}) {
108 #move out new line
109 chomp(@current[$settings{'KEY1'}]);
110 my @temp = split(/\,/,@current[$settings{'KEY1'}]);
111 my $K2=$settings{'KEY2'};
112 $temp[ $K2 ] = ( $temp[ $K2 ] eq 'on') ? '' : 'on'; # Toggle the field
113 @current[$settings{'KEY1'}] = join (',',@temp)."\n";
114 $settings{'KEY1'} = ''; # End edit mode
115 &General::log($Lang::tr{'ddns hostname modified'});
116
117 # Write changes to config file.
118 &WriteDataFile; # sort newly added/modified entry
119}
120
121if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
122 # Validate inputs
123
124 unless ($settings{'LOGIN'} ne '') {
125 $errormessage = $Lang::tr{'username not set'};
126 }
127
128 # list box returns 'service optional synonyms'
129 # keep only first name
130 $settings{'SERVICE'} =~ s/ .*$//;
131
132 # for freedns.afraid.org, only 'connect string' is mandatory
133 if ($settings{'SERVICE'} ne 'freedns.afraid.org') {
134 unless ($settings{'SERVICE'} eq 'regfish.com' || $settings{'PASSWORD'} ne '') {
135 $errormessage = $Lang::tr{'password not set'};
136 }
137 unless ($settings{'PASSWORD'} eq $settings{'PASSWORD2'}) {
138 $errormessage = $Lang::tr{'passwords do not match'};
139 }
140
141 # Permit an empty HOSTNAME for the nsupdate, regfish, dyndns, enom, ovh, zoneedit, no-ip, easydns
ff6f0295 142 #and namecheap
ac1cfefa
MT
143 unless ($settings{'SERVICE'} eq 'zoneedit.com' || $settings{'SERVICE'} eq 'nsupdate' ||
144 $settings{'SERVICE'} eq 'dyndns-custom'|| $settings{'SERVICE'} eq 'regfish.com' ||
145 $settings{'SERVICE'} eq 'enom.com' || $settings{'SERVICE'} eq 'dnspark.com' ||
146 $settings{'SERVICE'} eq 'ovh.com' || $settings{'HOSTNAME'} ne '' ||
ff6f0295
AB
147 $settings{'SERVICE'} eq 'no-ip.com' || $settings{'SERVICE'} eq 'easydns.com' ||
148 $settings{'SERVICE'} eq 'namecheap.com' ) {
ac1cfefa
MT
149 $errormessage = $Lang::tr{'hostname not set'};
150 }
151 unless ($settings{'HOSTNAME'} eq '' || $settings{'HOSTNAME'} =~ /^[a-zA-Z_0-9-]+$/) {
152 $errormessage = $Lang::tr{'invalid hostname'};
153 }
154 unless ($settings{'DOMAIN'} ne '') {
155 $errormessage = $Lang::tr{'domain not set'};
156 }
157 unless ($settings{'DOMAIN'} =~ /^[a-zA-Z_0-9.-]+$/) {
158 $errormessage = $Lang::tr{'invalid domain name'};
159 }
160 unless ($settings{'DOMAIN'} =~ /[.]/) {
161 $errormessage = $Lang::tr{'invalid domain name'};
162 }
163 }
164
165 # recheck service wich don't need too much fields
166 if ($settings{'SERVICE'} eq 'cjb.net') {
167 $errormessage = ''; # clear previous error
168 unless ($settings{'LOGIN'} ne '') {
169 $errormessage = $Lang::tr{'username not set'};
170 }
171 unless ($settings{'PASSWORD'} ne '') {
172 $errormessage = $Lang::tr{'password not set'};
173 }
174 unless ($settings{'PASSWORD'} eq $settings{'PASSWORD2'}) {
175 $errormessage = $Lang::tr{'passwords do not match'};
176 }
177 }
178
179 unless ($errormessage) {
180 if ($settings{'KEY1'} eq '') { #add or edit ?
181 unshift (@current, "$settings{'SERVICE'},$settings{'HOSTNAME'},$settings{'DOMAIN'},$settings{'PROXY'},$settings{'WILDCARDS'},$settings{'LOGIN'},$settings{'PASSWORD'},$settings{'ENABLED'}\n");
182 &General::log($Lang::tr{'ddns hostname added'});
183 } else {
184 @current[$settings{'KEY1'}] = "$settings{'SERVICE'},$settings{'HOSTNAME'},$settings{'DOMAIN'},$settings{'PROXY'},$settings{'WILDCARDS'},$settings{'LOGIN'},$settings{'PASSWORD'},$settings{'ENABLED'}\n";
185 $settings{'KEY1'} = ''; # End edit mode
186 &General::log($Lang::tr{'ddns hostname modified'});
187 }
188 map ($settings{$_}='' ,@nosaved); # Clear fields
189 # Write changes to config file.
190 &WriteDataFile; # sort newly added/modified entry
191 }
192}
193
194if ($settings{'ACTION'} eq $Lang::tr{'edit'}) {
195 #move out new line
196 my $line = @current[$settings{'KEY1'}]; # KEY1 is the index in current
197 chomp($line);
198 my @temp = split(/\,/, $line);
199 $settings{'SERVICE'} = $temp[0];
200 $settings{'HOSTNAME'} = $temp[1];
201 $settings{'DOMAIN'} = $temp[2];
202 $settings{'PROXY'} = $temp[3];
203 $settings{'WILDCARDS'} = $temp[4];
204 $settings{'LOGIN'} = $temp[5];
205 $settings{'PASSWORD'} = $settings{'PASSWORD2'} = $temp[6];
206 $settings{'ENABLED'} = $temp[7];
207}
208
209if ($settings{'ACTION'} eq $Lang::tr{'remove'}) {
210 splice (@current,$settings{'KEY1'},1); # Delete line
211 open(FILE, ">$datafile") or die 'ddns datafile error';
212 print FILE @current;
213 close(FILE);
214 $settings{'KEY1'} = ''; # End remove mode
215 &General::log($Lang::tr{'ddns hostname removed'});
216 # Write changes to config file.
217 &WriteDataFile;
218}
219
220if ($settings{'ACTION'} eq $Lang::tr{'instant update'}) {
221 system('/usr/local/bin/setddns.pl', '-f');
222}
223
224
225if ($settings{'ACTION'} eq '')
226{
227 $settings{'SERVICE'} = 'dyndns.org';
228 $settings{'ENABLED'} = 'on';
229}
230
231&Header::openpage($Lang::tr{'dynamic dns'}, 1, '');
232&Header::openbigbox('100%', 'left', '', $errormessage);
233
234my %checked =(); # Checkbox manipulations
235$checked{'SERVICE'}{'cjb.net'} = '';
236$checked{'SERVICE'}{'dhs.org'} = '';
237$checked{'SERVICE'}{'dnspark.com'} = '';
238$checked{'SERVICE'}{'dtdns.com'} = '';
239$checked{'SERVICE'}{'dyndns.org'} = '';
240$checked{'SERVICE'}{'dyndns-custom'} = '';
241$checked{'SERVICE'}{'dyndns-static'} = '';
242$checked{'SERVICE'}{'dyns.cx'} = '';
243$checked{'SERVICE'}{'dynu.ca'} = '';
244$checked{'SERVICE'}{'easydns.com'} = '';
245$checked{'SERVICE'}{'enom.com'} = '';
246$checked{'SERVICE'}{'freedns.afraid.org'} = '';
247$checked{'SERVICE'}{'hn.org'} = '';
ff6f0295 248$checked{'SERVICE'}{'namecheap.com'} = '';
ac1cfefa
MT
249$checked{'SERVICE'}{'no-ip.com'} = '';
250$checked{'SERVICE'}{'nsupdate'} = '';
251$checked{'SERVICE'}{'ovh.com'} = '';
252$checked{'SERVICE'}{'regfish.com'} = '';
253$checked{'SERVICE'}{'selfhost.de'} = '';
b411505d 254$checked{'SERVICE'}{'strato.com'} = '';
ac1cfefa
MT
255$checked{'SERVICE'}{'tzo.com'} = '';
256$checked{'SERVICE'}{'zoneedit.com'} = '';
257$checked{'SERVICE'}{$settings{'SERVICE'}} = "selected='selected'";
258
259$checked{'BEHINDROUTER'}{'RED_IP'} = '';
260$checked{'BEHINDROUTER'}{'FETCH_IP'} = '';
261$checked{'BEHINDROUTER'}{$settings{'BEHINDROUTER'}} = "checked='checked'";
262$checked{'MINIMIZEUPDATES'} = ($settings{'MINIMIZEUPDATES'} eq '' ) ? '' : "checked='checked'";
263
264$checked{'PROXY'}{'on'} = ($settings{'PROXY'} eq '') ? '' : "checked='checked'";
265$checked{'WILDCARDS'}{'on'} = ($settings{'WILDCARDS'} eq '') ? '' : "checked='checked'";
266$checked{'ENABLED'}{'on'} = ($settings{'ENABLED'} eq '' ) ? '' : "checked='checked'";
267
268if ($errormessage) {
269 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
270 print "<font class='base'>$errormessage&nbsp;</font>";
271 &Header::closebox();
272}
273
274if ($warnmessage) {
275 $warnmessage = "<font color=${Header::colourred}><b>$Lang::tr{'capswarning'}</b></font>: $warnmessage";
276}
277&Header::openbox('100%', 'left', $Lang::tr{'settings'});
278print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>";
279print <<END
280<table width='100%'>
281<tr>
282 <td class='base'>$Lang::tr{'dyn dns source choice'}</td>
283</tr><tr>
284 <td class='base'><input type='radio' name='BEHINDROUTER' value='RED_IP' $checked{'BEHINDROUTER'}{'RED_IP'} />
78331e30 285 $Lang::tr{'use ipfire red ip'}</td>
ac1cfefa
MT
286</tr><tr>
287 <td class='base'><input type='radio' name='BEHINDROUTER' value='FETCH_IP' $checked{'BEHINDROUTER'}{'FETCH_IP'} />
288 $Lang::tr{'fetch ip from'} <img src='/blob.gif' alt='*' /></td>
289</tr>
290<tr>
291 <td class='base'><input type='checkbox' name='MINIMIZEUPDATES' $checked{'MINIMIZEUPDATES'} />
292 $Lang::tr{'ddns minimize updates'}</td>
293</tr>
294</table>
295<br /><hr />
296END
297;
298
299print <<END
300<table width='100%'>
301<tr>
302 <td class='base' valign='top'><img src='/blob.gif' alt='*' /></td>
303 <td width='70%' class='base'>$Lang::tr{'avoid dod'}</td>
304 <td width='30%' align='center' class='base'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
305</tr>
306</table>
307</form>
308END
309;
310&Header::closebox(); # end of Settings1
311
312
313my $buttontext = $Lang::tr{'add'};
314if ($settings{'KEY1'} ne '') {
315 $buttontext = $Lang::tr{'update'};
316 &Header::openbox('100%', 'left', $Lang::tr{'edit an existing host'});
317} else {
318 &Header::openbox('100%', 'left', $Lang::tr{'add a host'});
319}
320
321#Edited line number (KEY1) passed until cleared by 'save' or 'remove'
322print <<END
323<form method='post' action='$ENV{'SCRIPT_NAME'}'>
324<input type='hidden' name='KEY1' value='$settings{'KEY1'}' />
325<table width='100%'>
326<tr>
327 <td width='25%' class='base'>$Lang::tr{'service'}:</td>
328 <td width='25%'><select size='1' name='SERVICE'>
329 <option $checked{'SERVICE'}{'cjb.net'}>cjb.net</option>
330 <option $checked{'SERVICE'}{'dhs.org'}>dhs.org</option>
331 <option $checked{'SERVICE'}{'dnspark.com'}>dnspark.com</option>
332 <option $checked{'SERVICE'}{'dtdns.com'}>dtdns.com</option>
333 <option $checked{'SERVICE'}{'dyndns.org'}>dyndns.org</option>
334 <option $checked{'SERVICE'}{'dyndns-custom'}>dyndns-custom</option>
335 <option $checked{'SERVICE'}{'dyndns-static'}>dyndns-static</option>
336 <option $checked{'SERVICE'}{'dyns.cx'}>dyns.cx</option>
337 <option $checked{'SERVICE'}{'dynu.ca'}>dynu.ca dyn.ee dynserv.(ca|org|net|com)</option>
338 <option $checked{'SERVICE'}{'easydns.com'}>easydns.com</option>
339 <option $checked{'SERVICE'}{'enom.com'}>enom.com</option>
340 <option $checked{'SERVICE'}{'freedns.afraid.org'}>freedns.afraid.org</option>
341 <option $checked{'SERVICE'}{'hn.org'}>hn.org</option>
ff6f0295 342 <option $checked{'SERVICE'}{'namecheap.com'}>namecheap.com</option>
ac1cfefa
MT
343 <option $checked{'SERVICE'}{'no-ip.com'}>no-ip.com</option>
344 <option $checked{'SERVICE'}{'nsupdate'}>nsupdate</option>
345 <option $checked{'SERVICE'}{'ovh.com'}>ovh.com</option>
346 <option $checked{'SERVICE'}{'regfish.com'}>regfish.com</option>
347 <option $checked{'SERVICE'}{'selfhost.de'}>selfhost.de</option>
b411505d 348 <option $checked{'SERVICE'}{'strato.com'}>strato.com</option>
ac1cfefa
MT
349<!-- <option $checked{'SERVICE'}{'tzo.com'}>tzo.com</option> comment this service out until a working fix is developed -->
350 <option $checked{'SERVICE'}{'zoneedit.com'}>zoneedit.com</option>
351 </select></td>
352 <td width='20%' class='base'>$Lang::tr{'hostname'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
353 <td width='30%'><input type='text' name='HOSTNAME' value='$settings{'HOSTNAME'}' /></td>
354</tr><tr>
355 <td class='base'>$Lang::tr{'behind a proxy'}</td>
356 <td><input type='checkbox' name='PROXY' value='on' $checked{'PROXY'}{'on'} /></td>
357 <td class='base'>$Lang::tr{'domain'}:</td>
358 <td><input type='text' name='DOMAIN' value='$settings{'DOMAIN'}' /></td>
359</tr><tr>
360 <td class='base'>$Lang::tr{'enable wildcards'}</td>
361 <td><input type='checkbox' name='WILDCARDS' value='on' $checked{'WILDCARDS'}{'on'} /></td>
362 <td class='base'>$Lang::tr{'username'}</td>
363 <td><input type='text' name='LOGIN' value='$settings{'LOGIN'}' /></td>
364</tr><tr>
365 <td></td>
366 <td></td>
367 <td class='base'>$Lang::tr{'password'}</td>
368 <td><input type='password' name='PASSWORD' value='$settings{'PASSWORD'}' /></td>
369</tr><tr>
370 <td class='base'>$Lang::tr{'enabled'}</td>
371 <td><input type='checkbox' name='ENABLED' value='on' $checked{'ENABLED'}{'on'} /></td>
372 <td class='base'>$Lang::tr{'again'}</td>
373 <td><input type='password' name='PASSWORD2' value='$settings{'PASSWORD2'}' /></td>
374</tr>
375</table>
376<hr />
377<table width='100%'>
378<tr>
379 <td class='base' valign='top'><img src='/blob.gif' alt='*' /></td>
380 <td width='70%' class='base'>$ddnsprefix</td>
381
382 <td width='30%' align='center' class='base'>
383 <input type='hidden' name='ACTION' value='$Lang::tr{'add'}' />
384 <input type='submit' name='SUBMIT' value='$buttontext' /> </td>
385</tr>
386</table>
387</form>
388END
389;
390&Header::closebox();
391
392#
393# Third box shows the list, in columns
394#
395&Header::openbox('100%', 'left', $Lang::tr{'current hosts'});
396print <<END
397<table width='100%'>
398<tr>
399 <td width='15%' align='center' class='boldbase'><b>$Lang::tr{'service'}</b></td>
400 <td width='25%' align='center' class='boldbase'><b>$Lang::tr{'hostname'}</b></td>
401 <td width='30%' align='center' class='boldbase'><b>$Lang::tr{'domain'}</b></td>
402 <td width='10%' align='center' class='boldbase'><b>$Lang::tr{'proxy'}</b></td>
403 <td width='10%' align='center' class='boldbase'><b>$Lang::tr{'wildcards'}</b></td>
404 <td width='10%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></td>
405</tr>
406END
407;
408my $ip = &General::GetDyndnsRedIP;
409my $key = 0;
410foreach my $line (@current) {
411 chomp($line); # remove newline
412 my @temp = split(/\,/,$line);
413
414 if ($temp[0] eq 'no-ip.com') {
415 $temp[1] =~ s!$General::noipprefix(.*)!<b>group:</b>$1 !;
416 }
417
418 #Choose icon for checkbox
419
420 my $gifproxy='';
421 my $descproxy='';
422 if ($temp[3] eq "on") {
423 $gifproxy = 'on.gif';
424 $descproxy = $Lang::tr{'click to disable'};
425 } else {
426 $gifproxy = 'off.gif';
427 $descproxy = $Lang::tr{'click to enable'};
428 }
429
430 my $gifwildcard='';
431 my $descwildcard='';
432 if ($temp[4] eq "on") {
433 $gifwildcard = 'on.gif';
434 $descwildcard = $Lang::tr{'click to disable'};
435 } else {
436 $gifwildcard = 'off.gif';
437 $descwildcard = $Lang::tr{'click to enable'};
438 }
439
440 my $sync = "<font color='blue'>";
441 my $gif = '';
442 my $gdesc = '';
443 if ($temp[7] eq "on") {
444 $gif = 'on.gif';
445 $gdesc = $Lang::tr{'click to disable'};
446 $sync = (&General::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "<font color='green'>": "<font color='red'>") ;
447 } else {
448 $gif = 'off.gif';
449 $gdesc = $Lang::tr{'click to enable'};
450 }
451
452 #Colorize each line
453 if ($settings{'KEY1'} eq $key) {
454 print "<tr bgcolor='${Header::colouryellow}'>";
455 } elsif ($key % 2) {
f2fdd0c1 456 print "<tr bgcolor='$color{'color22'}'>";
ac1cfefa 457 } else {
f2fdd0c1 458 print "<tr bgcolor='$color{'color20'}'>";
ac1cfefa
MT
459 }
460
461 #if a field is empty, replace it with a '---' to see colorized info!
462 $temp[1] = '---' if (!$temp[1]);
463 $temp[2] = '---' if (!$temp[2]);
464
465 print <<END
466<td align='center'><a href='http://$temp[0]'>$temp[0]</a></td>
467<td align='center'>$sync$temp[1]</td>
468<td align='center'>$sync$temp[2]</td>
469
470<td align='center'>
471<form method='post' action='$ENV{'SCRIPT_NAME'}'>
472<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
473<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gifproxy' alt='$descproxy' title='$descproxy' />
474<input type='hidden' name='KEY1' value='$key' />
475<input type='hidden' name='KEY2' value='3' />
476</form>
477</td>
478
479<td align='center'>
480<form method='post' action='$ENV{'SCRIPT_NAME'}'>
481<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
482<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gifwildcard' alt='$descwildcard' title='$descwildcard' />
483<input type='hidden' name='KEY1' value='$key' />
484<input type='hidden' name='KEY2' value='4' />
485</form>
486</td>
487
488<td align='center'>
489<form method='post' action='$ENV{'SCRIPT_NAME'}'>
490<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
491<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' alt='$gdesc' title='$gdesc' />
492<input type='hidden' name='KEY1' value='$key' />
493<input type='hidden' name='KEY2' value='7' />
494</form>
495</td>
496
497<td align='center'>
498<form method='post' action='$ENV{'SCRIPT_NAME'}'>
499<input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
500<input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
501<input type='hidden' name='KEY1' value='$key' />
502</form>
503</td>
504
505<td align='center'>
506<form method='post' action='$ENV{'SCRIPT_NAME'}'>
507<input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
508<input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' />
509<input type='hidden' name='KEY1' value='$key' />
510</form>
511</td>
512</tr>
513END
514;
515 $key++;
516}
517print "</table>";
518
519# If table contains entries, print 'Key to action icons'
520if ($key) {
521print <<END
522<table width='100%'>
523<tr>
524 <td class='boldbase'>&nbsp;<b>$Lang::tr{'legend'}:&nbsp;</b></td>
525 <td><img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
526 <td class='base'>$Lang::tr{'click to disable'}</td>
527 <td>&nbsp;&nbsp;</td>
528 <td><img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
529 <td class='base'>$Lang::tr{'click to enable'}</td>
530 <td>&nbsp;&nbsp;</td>
531 <td><img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
532 <td class='base'>$Lang::tr{'edit'}</td>
533 <td>&nbsp;&nbsp;</td>
534 <td><img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
535 <td class='base'>$Lang::tr{'remove'}</td>
536 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
537 <td align='center' width='30%'><input type='submit' name='ACTION' value='$Lang::tr{'instant update'}' /></td>
538 </form>
539</tr>
540</table>
541END
542;
543}
544
545&Header::closebox();
546&Header::closebigbox();
547&Header::closepage();
548
549## Ouf it's the end !
550
551
552# write the "current" array
553sub WriteDataFile {
554 #Save current
555 open(FILE, ">$datafile") or die 'ddns datafile error';
556 print FILE @current;
557 close (FILE);
558}