如果自定义字段 1 等于正则表达式,则拒绝用户注册

发布于 2024-10-10 22:51:46 字数 487 浏览 0 评论 0原文

当涉及到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

染火枫林 2024-10-17 22:51:46

假设版本 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文