diff options
author | jim-p <jimp@pfsense.org> | 2010-05-21 13:31:33 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-05-21 13:31:33 -0400 |
commit | 6d1af0e9d8e4398f71a572bb1cf2b4174ac5503b (patch) | |
tree | 32c8f476de3b78a35ae7254575b13bb915d3104e /usr/local/www/services_dhcp.php | |
parent | dc4f649eb85b3bd2476cfbd59c0f81571870c7a9 (diff) | |
download | pfsense-6d1af0e9d8e4398f71a572bb1cf2b4174ac5503b.zip pfsense-6d1af0e9d8e4398f71a572bb1cf2b4174ac5503b.tar.gz |
Preserve DHCP numbered options when there is an input error. Fixes #494
Diffstat (limited to 'usr/local/www/services_dhcp.php')
-rwxr-xr-x | usr/local/www/services_dhcp.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index b72258f..0a9bb46 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -193,6 +193,18 @@ if ($_POST) { $pconfig = $_POST; + $numberoptions = array(); + for($x=0; $x<99; $x++) { + if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) { + $numbervalue = array(); + $numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]); + $numbervalue['value'] = htmlspecialchars($_POST["value{$x}"]); + $numberoptions['item'][] = $numbervalue; + } + } + // Reload the new pconfig variable that the forum uses. + $pconfig['numberoptions'] = $numberoptions; + /* input validation */ if ($_POST['enable']) { $reqdfields = explode(" ", "range_from range_to"); @@ -313,17 +325,8 @@ if ($_POST) { // Handle the custom options rowhelper if(isset($config['dhcpd'][$if]['numberoptions']['item'])) unset($config['dhcpd'][$if]['numberoptions']['item']); - for($x=0; $x<99; $x++) { - if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) { - $numbervalue = array(); - $numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]); - $numbervalue['value'] = htmlspecialchars($_POST["value{$x}"]); - $config['dhcpd'][$if]['numberoptions']['item'][] = $numbervalue; - } - } - - // Reload the new pconfig variable that the forum uses. - $pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions']; + + $config['dhcpd'][$if]['numberoptions'] = $numberoptions; write_config(); |