⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit_bifc.cgi

📁 Unix下基于Web的管理工具
💻 CGI
字号:
#!/usr/local/bin/perl# edit_bifc.cgi# Edit or create a bootup interfacerequire './net-lib.pl';&ReadParse();if ($in{'new'}) {	&header("Create Bootup Interface", "");	}else {	&header("Edit Bootup Interface", "");	@boot = &boot_interfaces();	$b = $boot[$in{'idx'}];	}print "<hr>\n";print "<form action=save_bifc.cgi>\n";print "<input type=hidden name=new value=\"$in{'new'}\">\n";print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";print "<table border width=100%>\n";print "<tr $tb> <td><b>",      $in{'virtual'} || $b && $b->{'virtual'} ne "" ? $text{'bifc_desc2'}						    : $text{'bifc_desc1'},      "</b></td> </tr>\n";print "<tr $cb> <td><table width=100%>\n";print "<tr> <td><b>$text{'ifcs_name'}</b></td> <td>\n";if ($in{'new'} && $in{'virtual'}) {	print "<input type=hidden name=name value=$in{'virtual'}>\n";	print "$in{'virtual'}:<input name=virtual size=3>\n";	}elsif ($in{'new'}) {	print "<input name=name size=6>\n";	}else {	print "<font size=+1><tt>$b->{'fullname'}</tt></font>\n";	}print "</td>\n";print "<td><b>$text{'ifcs_ip'}</b></td> <td>\n";$virtual = (!$b && $in{'virtual'}) || ($b && $b->{'virtual'} ne "");$dhcp = &can_edit("dhcp") && !$virtual;$bootp = &can_edit("bootp") && !$virtual;if ($dhcp) {	printf "<input type=radio name=mode value=dhcp %s> %s\n",		$b && $b->{'dhcp'} ? "checked" : "", $text{'ifcs_dhcp'};	}if ($bootp) {	printf "<input type=radio name=mode value=bootp %s> %s\n",		$b && $b->{'bootp'} ? "checked" : "", $text{'ifcs_bootp'};	}if ($dhcp || $bootp) {	printf "<input type=radio name=mode value=address %s>\n",		!$b || (!$b->{'bootp'} && !$b->{'dhcp'}) ? "checked" : "";	}else {	print "<input type=hidden name=mode value=address>\n";	}printf "<input name=address size=15 value=\"%s\"></td> </tr>\n",	$b && !$b->{'bootp'} && !$b->{'dhcp'} ? $b->{'address'} : "";print "<tr> <td><b>$text{'ifcs_mask'}</b></td>\n";if (&can_edit("netmask", $b)) {	printf "<td><input name=netmask size=15 value='%s'></td>\n",		$b ? $b->{'netmask'} : "";	}else {	printf "<td>%s</td>\n", $b ? $b->{'netmask'} : $text{'ifcs_auto'};	}print "<td><b>$text{'ifcs_broad'}</b></td>\n";if (&can_edit("broadcast", $b)) {	printf "<td><input name=broadcast size=15 value='%s'></td>\n",		$b ? $b->{'broadcast'} : "";	}else {	printf "<td>%s</td> </tr>\n", $b ? $b->{'broadcast'}					 : $text{'ifcs_auto'};	}print "<tr> <td><b>$text{'ifcs_mtu'}</b></td>\n";if (&can_edit("mtu", $b)) {	printf "<td><input name=mtu size=15 value='%s'></td>\n",		$b ? $b->{'mtu'} : "";	}else {	printf "<td>%s</td>\n", $b && $b->{'mtu'} ? $b->{'mtu'}						  : $text{'ifcs_auto'};	}print "<td><b>$text{'ifcs_act'}</b></td>\n";if (&can_edit("up", $b)) {	printf "<td><input type=radio name=up value=1 %s> $text{'yes'}\n",		!$b || $b->{'up'} ? "checked" : "";	printf "<input type=radio name=up value=0 %s> $text{'no'}</td>\n",		$b && !$b->{'up'} ? "checked" : "";	}else {	printf "<td>%s</td> </tr>\n",		!$b ? $text{'yes'} :		$b->{'up'} ? $text{'yes'} : $text{'no'};	}print "<tr> <td colspan=2></td>\n";if ($b && $b->{'virtual'} eq "") {	print "<td><b>$text{'ifcs_virts'}</b></td>\n";	$vcount = 0;	foreach $vb (@boot) {		if ($vb->{'virtual'} ne "" && $vb->{'name'} eq $b->{'name'}) {			$vcount++;			}		}	print "<td>$vcount\n";	print "(<a href='edit_bifc.cgi?new=1&virtual=$b->{'name'}'>",	      "$text{'ifcs_addvirt'}</a>)</td>\n";	}print "</tr>\n";     print "</table></td></tr></table>\n";print "<table width=100%><tr>\n";if ($in{'new'}) {	print "<td><input type=submit value='$text{'create'}'></td>\n";	}else {	print "<td><input type=submit value='$text{'save'}'></td>\n";	if (!($b->{'bootp'} || $b->{'dhcp'})) {		print "<td align=center><input type=submit ",		      "name=activate value=\"$text{'bifc_apply'}\"></td>\n";		}	print "<td align=right><input type=submit name=delete ",	      "value='$text{'delete'}'></td>\n";	}print "</tr></table></form>\n";print "<hr>\n";&footer("list_ifcs.cgi", $text{'ifcs_return'});

⌨️ 快捷键说明

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