本文整理汇总了PHP中openvpn_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP openvpn_delete函数的具体用法?PHP openvpn_delete怎么用?PHP openvpn_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了openvpn_delete函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gettext
$input_errors[] = gettext("Server Bridge DHCP Start must be an IPv4 address.");
}
if ($pconfig['serverbridge_dhcp_end'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_end'])) {
$input_errors[] = gettext("Server Bridge DHCP End must be an IPv4 address.");
}
if (ip2ulong($pconfig['serverbridge_dhcp_start']) > ip2ulong($pconfig['serverbridge_dhcp_end'])) {
$input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end).");
}
}
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
if (count($input_errors) == 0) {
// validation correct, save data
$server = array();
// delete(rename) old interface so a new TUN or TAP interface can be created.
if (isset($id) && $pconfig['dev_mode'] != $a_server[$id]['dev_mode']) {
openvpn_delete('server', $a_server[$id]);
}
// 1 on 1 copy of config attributes
$copy_fields = "mode,protocol,dev_mode,local_port,description,crypto,digest,engine\n\t\t\t\t\t\t,tunnel_network,tunnel_networkv6,remote_network,remote_networkv6\n\t\t\t\t\t\t,gwredir,local_network,local_networkv6,maxclients,compression\n\t\t\t\t\t\t,passtos,client2client,dynamic_ip,pool_enable,topology_subnet\n\t\t\t\t\t\t,serverbridge_dhcp,serverbridge_interface,serverbridge_dhcp_start\n\t\t\t\t\t\t,serverbridge_dhcp_end,dns_domain,dns_server1,dns_server2,dns_server3\n\t\t\t\t\t\t,dns_server4,push_register_dns,ntp_server1,ntp_server2,netbios_enable\n\t\t\t\t\t\t,netbios_ntype,netbios_scope,no_tun_ipv6,verbosity_level,wins_server1\n\t\t\t\t\t\t,wins_server2,client_mgmt_port";
foreach (explode(",", $copy_fields) as $fieldname) {
$fieldname = trim($fieldname);
if (isset($pconfig[$fieldname])) {
$server[$fieldname] = $pconfig[$fieldname];
}
}
// attributes containing some kind of logic
if ($vpnid != 0) {
$server['vpnid'] = $vpnid;
} else {
$server['vpnid'] = openvpn_vpnid_next();
}
示例2: elseif
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
}
if (isset($_POST['act'])) {
$act = $_POST['act'];
}
if ($act == "del") {
// remove client
if (!isset($id) || !isset($a_client[$id])) {
redirectHeader("vpn_openvpn_client.php");
exit;
}
if (!empty($a_client[$id])) {
openvpn_delete('client', $a_client[$id]);
}
unset($a_client[$id]);
write_config();
} else {
// update client (after validation)
$pconfig = $_POST;
$input_errors = array();
if (isset($id) && $a_client[$id]) {
$vpnid = $a_client[$id]['vpnid'];
}
if (isset($pconfig['mode']) && $pconfig['mode'] != "p2p_shared_key") {
$tls_mode = true;
} else {
$tls_mode = false;
}