| | |
| | | $values = explode(",", $field_value); |
| | | foreach($values as $cur_value) { |
| | | $cur_value = trim($cur_value); |
| | | |
| | | $valid = true; |
| | | // if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) { |
| | | if(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $cur_value)) { |
| | | $groups = explode(".", $cur_value); |
| | | foreach($groups as $group){ |
| | | if($group<0 or $group>255) |
| | | $valid=false; |
| | | if(function_exists('filter_var')) { |
| | | if(!filter_var($cur_value, FILTER_VALIDATE_IP)) { |
| | | $valid = false; |
| | | } |
| | | } else { |
| | | $valid = false; |
| | | } |
| | | } else return "function filter_var missing <br />\r\n"; |
| | | |
| | | if($valid == false) { |
| | | $errmsg = $validator['errmsg']; |