From dcef4b5ba15e3c157f4c3b0b6b6ca33ab78a554a Mon Sep 17 00:00:00 2001 From: sullrich Date: Tue, 15 Dec 2009 09:12:56 -0500 Subject: pick up frontend ports correctly --- config/haproxy/haproxy.inc | 4 ++-- config/haproxy/haproxy_servers_edit.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index c9ce9695..59350259 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -218,9 +218,9 @@ function haproxy_configure() { else $cookie = ""; if(!$server['port']) { + $server_ports = ""; + $isfirst = true; foreach($ports as $port) { - $isfirst = false; - $server_ports = ""; if($port) { if(!$isfirst) $server_ports .= ","; diff --git a/config/haproxy/haproxy_servers_edit.php b/config/haproxy/haproxy_servers_edit.php index 9ea8e64b..8af4fc90 100755 --- a/config/haproxy/haproxy_servers_edit.php +++ b/config/haproxy/haproxy_servers_edit.php @@ -78,11 +78,12 @@ if ($_POST) { if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['cookie'])) $input_errors[] = "The field 'Cookie' contains invalid characters."; - if (!is_numeric($_POST['port'])) + if ($_POST['port'] && !is_numeric($_POST['port'])) $input_errors[] = "The field 'Port' value is not a number."; else { - if (!($_POST['port']>=1 && $_POST['port']<=65535)) - $input_errors[] = "The field 'Port' value must be between 1 and 65535."; + if ($_POST['port']) + if (!($_POST['port']>=1 && $_POST['port']<=65535)) + $input_errors[] = "The field 'Port' value must be between 1 and 65535."; } if (!is_numeric($_POST['weight'])) -- cgit v1.2.3