= $subnet_start) && (ip2ulong($_POST['localip']) <= $subnet_end)) $input_errors[] = gettext("The specified server address lies in the remote subnet."); if ($_POST['localip'] == get_interface_ip($_POST['interface'])) $input_errors[] = gettext("The specified server address is equal to an interface ip address."); for($x=0; $x<4999; $x++) { if ($_POST["username{$x}"]) { if (empty($_POST["password{$x}"])) $input_errors[] = sprintf(gettext("No password specified for username %s"),$_POST["username{$x}"]); if ($_POST["ip{$x}"] <> "" && !is_ipaddr($_POST["ip{$x}"])) $input_errors[] = sprintf(gettext("Incorrect ip address specified for username %s"),$_POST["username{$x}"]); } } } if ($_POST['pppoeid'] && !is_numeric($_POST['pppoeid'])) $input_errors[] = gettext("Wrong data submitted"); if (!$input_errors) { $pppoecfg = array(); $pppoecfg['remoteip'] = $_POST['remoteip']; $pppoecfg['localip'] = $_POST['localip']; $pppoecfg['mode'] = $_POST['mode']; $pppoecfg['interface'] = $_POST['interface']; $pppoecfg['n_pppoe_units'] = $_POST['n_pppoe_units']; $pppoecfg['pppoe_subnet'] = $_POST['pppoe_subnet']; $pppoecfg['descr'] = $_POST['descr']; if ($_POST['radiusserver'] || $_POST['radiusserver2']) { $pppoecfg['radius'] = array(); $pppoecfg['radius']['nasip'] = $_POST['radius_nasip']; $pppoecfg['radius']['acct_update'] = $_POST['radius_acct_update']; } if ($_POST['radiusserver']) { $pppoecfg['radius']['server'] = array(); $pppoecfg['radius']['server']['ip'] = $_POST['radiusserver']; $pppoecfg['radius']['server']['secret'] = $_POST['radiussecret']; $pppoecfg['radius']['server']['port'] = $_POST['radiusserverport']; $pppoecfg['radius']['server']['acctport'] = $_POST['radiusserveracctport']; } if ($_POST['radiusserver2']) { $pppoecfg['radius']['server2'] = array(); $pppoecfg['radius']['server2']['ip'] = $_POST['radiusserver2']; $pppoecfg['radius']['server2']['secret2'] = $_POST['radiussecret2']; $pppoecfg['radius']['server2']['port'] = $_POST['radiusserver2port']; $pppoecfg['radius']['server2']['acctport'] = $_POST['radiusserver2acctport']; } if ($_POST['pppoe_dns1'] <> "") $pppoecfg['dns1'] = $_POST['pppoe_dns1']; if ($_POST['pppoe_dns2'] <> "") $pppoecfg['dns2'] = $_POST['pppoe_dns2']; if($_POST['radiusenable'] == "yes") $pppoecfg['radius']['server']['enable'] = true; if($_POST['radiussecenable'] == "yes") $pppoecfg['radius']['server2']['enable'] = true; if($_POST['radacct_enable'] == "yes") $pppoecfg['radius']['accounting'] = true; if($_POST['radiusissueips'] == "yes") $pppoecfg['radius']['radiusissueips'] = true; if($_POST['pppoeid']) $pppoecfg['pppoeid'] = $_POST['pppoeid']; else $pppoecfg['pppoeid'] = vpn_pppoe_get_id(); $users = array(); for($x=0; $x<4999; $x++) { if ($_POST["username{$x}"]) { $usernam = $_POST["username{$x}"] . ":" . base64_encode($_POST["password{$x}"]); if ($_POST["ip{$x}"]) $usernam .= ":" . $_POST["ip{$x}"]; $users[] = $usernam; } } if (count($users) > 0) $pppoecfg['username'] = implode(" ", $users); if (!isset($id)) $id = count($a_pppoes); if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply")); else $toapplylist = array(); $toapplylist[] = $pppoecfg['pppoeid']; $a_pppoes[$id] = $pppoecfg; write_config(); mark_subsystem_dirty('vpnpppoe'); file_put_contents("{$g['tmp_path']}/.vpn_pppoe.apply", serialize($toapplylist)); header("Location: vpn_pppoe.php"); exit; } } $pgtitle = array(gettext("Services"),gettext("PPPoE Server"), gettext("Edit")); $shortcut_section = "pppoes"; include("head.inc"); ?>