function clean_form_input($input) { foreach ($input as $field_name => $value) { if (is_array($value)) { foreach ($value as $mf_name => $mf_value) { $value[$mf_name] = clean_string_input($mf_value); } } else { $input[$field_name] = clean_string_input($value); } } return $input; }
function clean_form_input($input, $maxlen = 99) { foreach ($input as $field_name => $value) { if (is_array($value)) { foreach ($value as $mf_name => $mf_value) { $value[$mf_name] = clean_string_input($mf_value); if (strlen($value[$mf_name]) > $maxlen) { die('error: data submitted was excessively large'); } } } else { $input[$field_name] = clean_string_input($value); if (strlen($input[$field_name]) > $maxlen) { die('error: data submitted was excessively large'); } } } return $input; }