Handle hostnames with upper-case letters
[webmin.git] / adsl-client / start.cgi
1 #!/usr/local/bin/perl
2 # start.cgi
3 # Start up the ADSL connection
4
5 require './adsl-client-lib.pl';
6 &ReadParse();
7 &error_setup($text{'start_err'});
8
9 $conf = &get_config();
10 $out = &backquote_logged("$config{'start_cmd'} 2>&1 </dev/null");
11 if ($?) {
12         &error("<pre>$out</pre>");
13         }
14
15 &ui_print_header(undef, $text{'start_title'}, "");
16
17 if (&find("CONNECT_TIMEOUT", $conf) == 0) {
18         # Will try forever .. but wait for 20 secs max
19         for($i=0; $i<20 && !$ip; $i++) {
20                 sleep(1);
21                 ($dev, $ip) = &get_adsl_ip();
22                 }
23         if ($ip) {
24                 print "<p>",&text('start_ip', "<tt>$ip</tt>"),"<p>\n";
25                 }
26         else {
27                 print "<p>$text{'start_bg'}</p>\n";
28                 }
29         }
30 elsif (&find("DEMAND", $conf) =~ /^\d+$/) {
31         # Only starts on demand
32         print "<p>$text{'start_demand'}</p>\n";
33         }
34 else {
35         # Can get the new IP
36         ($dev, $ip) = &get_adsl_ip();
37         print "<p>",&text('start_ip', "<tt>$ip</tt>"),"<p>\n";
38         }
39 &webmin_log("start");
40
41 &ui_print_footer("", $text{'index_return'});
42