开发者

Deny user registration if custom field 1 is equal to a regex

开发者 https://www.devze.com 2023-02-02 23:48 出处:网络
I\'m beginner - mid range when it comes to php knowledge and complete beginner when it comes to modifying phpbb.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消