如果自定义字段 1 等于正则表达式,则拒绝用户注册
当涉及到 php 知识时,我是初学者 - 中等范围,而当涉及到修改 phpbb 时,我是完全初学者。
我发现很难在 phpbb 的网站上找到任何关于塑造 phpbb 的有用信息。 因此,如果您有 phpbb 成型的良好资源,我很想了解它。
无论如何,回答我的问题: 我发现垃圾邮件发送者总是使用一些可以轻松与正则表达式匹配的代码来回答我的自定义字段之一,那么如何编写此代码呢?
我知道如何在 php 中做到这一点,但是如何将其集成到 phpbb 注册论坛中?
$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.";
}
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 how 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.";
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设版本 3.0.8:
在includes/functions_profile_fields.php第91行中,您将找到函数
validate_profile_field($field_type, &$field_value, $field_data)
在那里您将看到 switch 语句不同字段类型的标准验证。
您可以在此块之后添加验证(第 189 行)。
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).