Skip to content

Commit 3ae3d88

Browse files
author
fantu
committed
add ip validator in form system, for now only for ipv4
1 parent 50b2c3e commit 3ae3d88

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,16 @@ function validateField($field_name, $field_value, $validators) {
630630
$this->errorMessage .= $errmsg."<br />\r\n";
631631
}
632632
}
633+
break;
634+
case 'ISIPV4':
635+
if(!preg_match("/^[0-9]{1,3}(.)[0-9]{1,3}(.)[0-9]{1,3}(.)[0-9]{1,3}$/", $field_value)) {
636+
$errmsg = $validator['errmsg'];
637+
if(isset($this->wordbook[$errmsg])) {
638+
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
639+
} else {
640+
$this->errorMessage .= $errmsg."<br />\r\n";
641+
}
642+
}
633643
break;
634644
case 'CUSTOM':
635645
// Calls a custom class to validate this record

0 commit comments

Comments
 (0)