if ($_POST['max'] != "" && !is_posnumericint($_POST['max'])) {
     $input_errors[] = gettext("Maximum state entries (advanced option) must be a positive integer");
 }
 if ($_POST['max-src-nodes'] != "" && !is_posnumericint($_POST['max-src-nodes'])) {
     $input_errors[] = gettext("Maximum number of unique source hosts (advanced option) must be a positive integer");
 }
 if ($_POST['max-src-conn'] != "" && !is_posnumericint($_POST['max-src-conn'])) {
     $input_errors[] = gettext("Maximum number of established connections per host (advanced option) must be a positive integer");
 }
 if ($_POST['max-src-states'] != "" && !is_posnumericint($_POST['max-src-states'])) {
     $input_errors[] = gettext("Maximum state entries per host (advanced option) must be a positive integer");
 }
 if ($_POST['max-src-conn-rate'] != "" && !is_posnumericint($_POST['max-src-conn-rate'])) {
     $input_errors[] = gettext("Maximum new connections per host / per second(s) (advanced option) must be a positive integer");
 }
 if ($_POST['statetimeout'] != "" && !is_posnumericint($_POST['statetimeout'])) {
     $input_errors[] = gettext("State timeout (advanced option) must be a positive integer");
 }
 if (($_POST['max-src-conn-rate'] != "" and $_POST['max-src-conn-rates'] == "") || ($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] != "")) {
     $input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified");
 }
 if (!$_POST['tcpflags_any']) {
     $settcpflags = array();
     $outoftcpflags = array();
     foreach ($tcpflags as $tcpflag) {
         if ($_POST['tcpflags1_' . $tcpflag] == "on") {
             $settcpflags[] = $tcpflag;
         }
         if ($_POST['tcpflags2_' . $tcpflag] == "on") {
             $outoftcpflags[] = $tcpflag;
         }
 if (!empty($pconfig['max']) && !is_posnumericint($pconfig['max'])) {
     $input_errors[] = gettext("Maximum state entries (advanced option) must be a positive integer");
 }
 if (!empty($pconfig['max-src-nodes']) && !is_posnumericint($pconfig['max-src-nodes'])) {
     $input_errors[] = gettext("Maximum number of unique source hosts (advanced option) must be a positive integer");
 }
 if (!empty($pconfig['max-src-conn']) && !is_posnumericint($pconfig['max-src-conn'])) {
     $input_errors[] = gettext("Maximum number of established connections per host (advanced option) must be a positive integer");
 }
 if (!empty($pconfig['max-src-states']) && !is_posnumericint($pconfig['max-src-states'])) {
     $input_errors[] = gettext("Maximum state entries per host (advanced option) must be a positive integer");
 }
 if (!empty($pconfig['max-src-conn-rate']) && !is_posnumericint($pconfig['max-src-conn-rate'])) {
     $input_errors[] = gettext("Maximum new connections per host / per second(s) (advanced option) must be a positive integer");
 }
 if (!empty($pconfig['statetimeout']) && !is_posnumericint($pconfig['statetimeout'])) {
     $input_errors[] = gettext("State timeout (advanced option) must be a positive integer");
 }
 if (empty($pconfig['max-src-conn-rate']) && !empty($pconfig['max-src-conn-rates']) || !empty($pconfig['max-src-conn-rate']) && empty($pconfig['max-src-conn-rates'])) {
     $input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified");
 }
 if (empty($pconfig['tcpflags2']) && !empty($pconfig['tcpflags1'])) {
     $input_errors[] = gettext("If you specify TCP flags that should be set you should specify out of which flags as well.");
 }
 if (count($input_errors) == 0) {
     $filterent = array();
     // 1-on-1 copy of form values
     $copy_fields = array('type', 'interface', 'ipprotocol', 'tag', 'tagged', 'max', 'max-src-nodes', 'max-src-conn', 'max-src-states', 'statetimeout', 'statetype', 'os', 'descr', 'gateway', 'sched', 'associated-rule-id', 'direction', 'quick', 'max-src-conn-rate', 'max-src-conn-rates');
     foreach ($copy_fields as $fieldname) {
         if (!empty($pconfig[$fieldname])) {
             if (is_array($pconfig[$fieldname])) {