Deny user registration if custom field 1 is equal to a regex
I'm beginner - mid range when it comes to php knowledge and complete beginner when it comes to modifying phpbb.
I have found it very hard to find any useful information on molding phpbb on phpbb's site. So if you have a good resource for phpbb molding I would love to know about it.
Anyway, onto my question: I have found that spammers always answer one of my custom fields with some code that can be easily matched with a regex, so h开发者_运维知识库ow would one go about coding this?
I know how I would do it in php, but how do I integrate this into the phpbb registration forum?
$text = "hgf384";
if (preg_match('/^[aA-zZ]{3}[0-9]{3}$/',$text) ) {
echo "Sorry $user we suspect you are a bot, banned.";
}
else {
echo "You seem human 10 points for you.";
}
Assuming version 3.0.8:
In includes/functions_profile_fields.php, line 91, you'll find the function validate_profile_field($field_type, &$field_value, $field_data)
There you'll see the switch statement with the standard validations for the different field types.
You can add your validation after this block (line 189).
精彩评论