return $error;
}
+// 2022 may 07
+// some additional checks to stay clear of some robots triggering
+// site registration storms
+// would detect an error if any of the folowing fields are
+// only numbers (the attack typically fills everything with '1')
+// besides, need to dig a bit because
+// the site registration that we get can't be Deleted
+// because some fields are missing (PI Phone and Tech Phone for example)
+function form_check_non_numeric($form, $input) {
+ $to_check = ["name", "login_base", "abbreviated_name", "url"];
+ $only_numeric = array();
+// var_dump($form);
+ foreach ($form as $fullname => $item) {
+ list($objname, $field) = explode(":", $fullname);
+ if (in_array($field, $to_check) && is_numeric($input[$objname][$field])) {
+ $only_numeric[] = $item['title'];
+ }
+ }
+ if (empty($only_numeric))
+ return "";
+ $error = "<ul>";
+ foreach ($only_numeric as $field) {
+ $error .= "<li> Field '$field' can not be only numeric.</li>";
+ }
+ $error .= "</ul>";
+ return $error;
+}
+
// displays the actual form, with values from $input
// if $outline_missing is set, missing required fields are outlined
// fields typed as 'password' are displayed differently