"; } if($_GET['act']=="edit"){ if (isset($id) && $a_csc[$id]) { $pconfig['custom_options'] = $a_csc[$id]['custom_options']; $pconfig['disable'] = isset($a_csc[$id]['disable']); $pconfig['common_name'] = $a_csc[$id]['common_name']; $pconfig['block'] = $a_csc[$id]['block']; $pconfig['description'] = $a_csc[$id]['description']; $pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network']; $pconfig['local_network'] = $a_csc[$id]['local_network']; $pconfig['local_networkv6'] = $a_csc[$id]['local_networkv6']; $pconfig['remote_network'] = $a_csc[$id]['remote_network']; $pconfig['remote_networkv6'] = $a_csc[$id]['remote_networkv6']; $pconfig['gwredir'] = $a_csc[$id]['gwredir']; $pconfig['push_reset'] = $a_csc[$id]['push_reset']; $pconfig['dns_domain'] = $a_csc[$id]['dns_domain']; if ($pconfig['dns_domain']) $pconfig['dns_domain_enable'] = true; $pconfig['dns_server1'] = $a_csc[$id]['dns_server1']; $pconfig['dns_server2'] = $a_csc[$id]['dns_server2']; $pconfig['dns_server3'] = $a_csc[$id]['dns_server3']; $pconfig['dns_server4'] = $a_csc[$id]['dns_server4']; if ($pconfig['dns_server1'] || $pconfig['dns_server2'] || $pconfig['dns_server3'] || $pconfig['dns_server4']) $pconfig['dns_server_enable'] = true; $pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1']; $pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2']; if ($pconfig['ntp_server1'] || $pconfig['ntp_server2']) $pconfig['ntp_server_enable'] = true; $pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable']; $pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype']; $pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope']; $pconfig['wins_server1'] = $a_csc[$id]['wins_server1']; $pconfig['wins_server2'] = $a_csc[$id]['wins_server2']; if ($pconfig['wins_server1'] || $pconfig['wins_server2']) $pconfig['wins_server_enable'] = true; $pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1']; if ($pconfig['nbdd_server1']) $pconfig['nbdd_server_enable'] = true; } } if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network')) $input_errors[] = $result; if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4")) $input_errors[] = $result; if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6")) $input_errors[] = $result; if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) $input_errors[] = $result; if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6")) $input_errors[] = $result; if ($pconfig['dns_server_enable']) { if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1']))) $input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address"); if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2']))) $input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address"); if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3']))) $input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address"); if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4']))) $input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address"); } if ($pconfig['ntp_server_enable']) { if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1']))) $input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address"); if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2']))) $input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address"); if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3']))) $input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address"); if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4']))) $input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address"); } if ($pconfig['netbios_enable']) { if ($pconfig['wins_server_enable']) { if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1']))) $input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address"); if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2']))) $input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address"); } if ($pconfig['nbdd_server_enable']) if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1']))) $input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address"); } $reqdfields[] = 'common_name'; $reqdfieldsn[] = 'Common name'; do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); if (!$input_errors) { $csc = array(); $csc['custom_options'] = $pconfig['custom_options']; if ($_POST['disable'] == "yes") $csc['disable'] = true; $csc['common_name'] = $pconfig['common_name']; $csc['block'] = $pconfig['block']; $csc['description'] = $pconfig['description']; $csc['tunnel_network'] = $pconfig['tunnel_network']; $csc['local_network'] = $pconfig['local_network']; $csc['local_networkv6'] = $pconfig['local_networkv6']; $csc['remote_network'] = $pconfig['remote_network']; $csc['remote_networkv6'] = $pconfig['remote_networkv6']; $csc['gwredir'] = $pconfig['gwredir']; $csc['push_reset'] = $pconfig['push_reset']; if ($pconfig['dns_domain_enable']) $csc['dns_domain'] = $pconfig['dns_domain']; if ($pconfig['dns_server_enable']) { $csc['dns_server1'] = $pconfig['dns_server1']; $csc['dns_server2'] = $pconfig['dns_server2']; $csc['dns_server3'] = $pconfig['dns_server3']; $csc['dns_server4'] = $pconfig['dns_server4']; } if ($pconfig['ntp_server_enable']) { $csc['ntp_server1'] = $pconfig['ntp_server1']; $csc['ntp_server2'] = $pconfig['ntp_server2']; } $csc['netbios_enable'] = $pconfig['netbios_enable']; $csc['netbios_ntype'] = $pconfig['netbios_ntype']; $csc['netbios_scope'] = $pconfig['netbios_scope']; if ($pconfig['netbios_enable']) { if ($pconfig['wins_server_enable']) { $csc['wins_server1'] = $pconfig['wins_server1']; $csc['wins_server2'] = $pconfig['wins_server2']; } if ($pconfig['dns_server_enable']) $csc['nbdd_server1'] = $pconfig['nbdd_server1']; } if (isset($id) && $a_csc[$id]) { $old_csc_cn = $a_csc[$id]['common_name']; $a_csc[$id] = $csc; } else $a_csc[] = $csc; if (!empty($old_csc_cn)) openvpn_cleanup_csc($old_csc_cn); openvpn_resync_csc($csc); write_config(); header("Location: vpn_openvpn_csc.php"); exit; } } include("head.inc"); ?> ">
/>  
.

.

.
/> .
.

.





.

.
/> .
/> .
onclick="dns_domain_change()" />
onclick="dns_server_change()" />
#1: 
#2: 
#3: 
#4: 
onclick="ntp_server_change()" />
#1: 
#2: 
onclick="netbios_change()" />
.


.

Scope ID: 
.
onclick="wins_server_change()" />
#1: 
#2: 


;
  " />
" width="17" height="17" border="0" alt="edit" />   ')"> " width="17" height="17" border="0" alt="delete" />
" width="17" height="17" border="0" alt="add" />