save_dns.cgi

来自「Unix下基于Web的管理工具」· CGI 代码 · 共 34 行

CGI
34
字号
#!/usr/local/bin/perl# save_dns.cgi# Save DNS client configurationrequire './net-lib.pl';$whatfailed = "Failed to save DNS configuration";&ReadParse();$in{'hostname'} =~ /^[A-z0-9\.\-]*$/ ||	&error("'$in{'hostname'}' is not a valid hostname");$dns = { };for($i=0; $i<$max_dns_servers; $i++) {	$ns = $in{"nameserver_$i"};	if ($ns) {		&check_ipaddress($ns) ||			&error("'$ns' is not a valid nameserver IP address");		push(@{$dns->{'nameserver'}}, $ns);		}	}if (!$in{'domain_def'}) {	@dlist = split(/\s+/, $in{'domain'});	foreach $d (@dlist) {		$d =~ /^[A-z0-9\.\-]+$/ ||			&error("'$d' is not a valid domain name");		push(@{$dns->{'domain'}}, $d);		}	@dlist>0 || &error("No domains to search given");	}&parse_order($dns);&save_dns_config($dns);&save_hostname($in{'hostname'});&redirect("");

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?