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