无需验证码即可阻止垃圾邮件
我想阻止垃圾邮件发送者使用我的网站。但我觉得验证码很烦人。我所说的不仅仅是“输入文本”类型,而是任何需要用户浪费时间来证明自己是人类的东西。
我在这里能做什么?
I want to stop spammers from using my site. But I find CAPTCHA very annoying. I am not just talking about the "type the text" type, but anything that requires the user to waste his time to prove himself human.
What can I do here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
要求 Javascript 发布数据会阻止相当数量的垃圾邮件机器人,同时不会干扰大多数用户。
您还可以使用一个巧妙的技巧:
大多数机器人都会填充第一个字段,因此您可以阻止它们。
Requiring Javascript to post data blocks a fair amount of spam bots while not interfering with most users.
You can also use an nifty trick:
Most bots will populate the first field, so you can block them.
我结合了一些到目前为止看起来相当成功的方法:
提供一个名为
email
的输入字段并使用 CSS 隐藏它显示:无
。提交表单后检查该字段是否为空的。机器人往往会用虚假的电子邮件地址填充此内容。
提供另一个隐藏的输入字段,其中包含页面的时间
已加载。检查加载和提交页面之间的时间是否
填写表格所需的最短时间较大。我用
5 到 10 秒之间。
然后检查 GET 参数的数量是否符合您的预期。
如果您的表单操作是 POST 并且您的表单的基础 URL
提交页面是
index.php?p=guestbook&sub=submit
,那么你预计有 2 个 GET 参数。机器人尝试添加 GET 参数,这样
检查会失败。
最后,检查是否设置了 HTTP_USER_AGENT,机器人有时不会设置,
HTTP_REFERER 是表单页面的 URL。机器人
有时只是 POST 到提交页面导致 HTTP_REFERER
最后
我的大部分信息来自 http://www.braemoor.co.uk/software/ antispam.shtml 和 http://www.nogbspam.com/。
I combine a few methods that seem quite successful so far:
Provide an input field with the name
email
and hide it with CSSdisplay: none
. When the form is submitted check if this field isempty. Bots tend to fill this with a bogus emailaddress.
Provide another hidden input field which contains the time the page
is loaded. Check if the time between loading and submitting the page
is larger the minimum time it takes to fill in the form. I use
between 5 and 10 seconds.
Then check if the number of GET parameters are as you would expect.
If your forms action is POST and the underlying URL of your
submission page is
index.php?p=guestbook&sub=submit
, then youexpect 2 GET parameters. Bots try to add GET parameters so this
check would fail.
And finally, check if the HTTP_USER_AGENT is set, which bots sometimes don't set,
and that the HTTP_REFERER is the URL of the page of your form. Bots
sometimes just POST to the submission page causing the HTTP_REFERER
to be something else.
I got most of my information from http://www.braemoor.co.uk/software/antispam.shtml and http://www.nogbspam.com/.
集成 Akismet API 以自动过滤用户的帖子。
Integrate the Akismet API to automatically filter your users' posts.
如果您正在寻找 .NET 解决方案,Ajax 控件工具包有一个名为 NoBot 的控件。
NoBot 采用了几种不同的反机器人技术:
更多讨论和演示在此 Jacques-Louis Chereau 在 NoBot 上发表的博客文章。
If you're looking for a .NET solution, the Ajax Control Toolkit has a control named NoBot.
NoBot employs a few different anti-bot techniques:
More discussion and demonstration at this blogpost by Jacques-Louis Chereau on NoBot.
我会小心地使用 CSS 或 Javascript 技巧来确保用户是一个真正的现实生活中的人,因为你可能会引入可访问性问题、跨浏览器问题等。更不用说垃圾邮件机器人可能相当复杂,因此使用可爱的小 CSS 显示无论如何,技巧可能都不起作用。
我会调查 Akismet。
此外,您还可以在验证用户数据的方式上发挥创意。例如,假设您有一个需要用户电子邮件和地址的注册表单。您可以相当严格地验证电子邮件地址,甚至确保域实际上已设置为接收邮件,并且该域上有一个与所提供的内容匹配的邮箱。您还可以使用 Google Maps API 尝试对地址进行地理定位并确保其有效。
为了更进一步,您可以实现“硬”和“软”验证错误。如果邮件地址与正则表达式验证字符串不匹配,那么这就是硬失败。无法检查域的 DNS 记录以确保其接受邮件或邮箱存在,属于“软”失败。当您遇到软失败时,您可以要求验证码验证。这有望减少您必须推动验证码验证的次数,因为如果您在网站上获得足够的活动,有效的人应该至少在某些时候输入有效的数据!
I would be careful using CSS or Javascript tricks to ensure a user is a genuine real life human, as you could be introducing accessibility issues, cross browser issues, etc. Not to mention spam bots can be fairly sophisticated, so employing cute little CSS display tricks may not even work anyway.
I would look into Akismet.
Also, you can be creative in the way you validate user data. For example, let's say you have a registration form that requires a user email and address. You can be fairly hardcore in how you validate the email address, even going so far as to ensure the domain is actually set up to receive mail, and that there is a mailbox on that domain that matches what was provided. You could also use Google Maps API to try and geolocate an address and ensure it's valid.
To take this even further, you could implement "hard" and "soft" validation errors. If the mail address doesn't match a regex validation string, then that's a hard fail. Not being able to check the DNS records of the domain to ensure it accepts mail, or that the mailbox exists, is a "soft" fail. When you encounter a soft fail, you could then ask for CAPTCHA validation. This would hopefully reduce the amount of times you'd have to push for CAPTCHA verification, because if you're getting enough activity on the site, valid people should be entering valid data at least some of the time!
我意识到这是一篇相当老的帖子,但是,我遇到了一个有趣的解决方案,称为“蜜罐验证码”,它很容易实现并且不需要 JavaScript:
提供一个隐藏文本框!
为了防止使用屏幕阅读器的用户落入陷阱,只需在文本框上贴上“如果您是人类,请留空”或其他类似的标签即可。
田田!非侵入式垃圾邮件拦截!这是文章:
http:// www.campaignmonitor.com/blog/post/3817/stopping-spambots-with-two-simple-captcha-alternatives
I realize this is a rather old post, however, I came across an interesting solution called the "honey-pot captcha" that is easy to implement and doesn't require javascript:
Provide a hidden text box!
To prevent a user with a screen reader from falling into your trap simply label the text box "If you are human, leave blank" or something to that affect.
Tada! Non-intrusive spam-blocking! Here is the article:
http://www.campaignmonitor.com/blog/post/3817/stopping-spambots-with-two-simple-captcha-alternatives
由于很难 100% 避免它,因此我建议阅读 这篇 IBM 文章 发表于 2 年前,标题为“真正的 Web 2.0:对抗网络垃圾邮件”,其中对访问者行为和控制工作流程进行了良好而简洁的分析
另外还链接了一个非常有趣的“...hashcash 技术,除了电子邮件之外,还可以最大程度地减少 Wiki 等上的垃圾邮件。"
Since it is extremely hard to avoid it at 100% I recommend to read this IBM article posted 2 years ago titled 'Real Web 2.0: Battling Web spam', where visitor behavior and control workflow are analyzed well and concise
Also is linked a very interesting "...hashcash technique for minimizing spam on Wikis and such, in addition to e-mail."
一个人类可读的问题告诉用户输入他在名字字段中输入的值的第一个字母和姓氏字段的最后一个字母或类似的内容怎么样?
或者显示一些用 JavaScript 填充的隐藏字段,其中包含引用者等值。检查这些字段与您之前存储在会话中的字段是否相等。
如果值为空,则用户没有 javascript。那么它就不是垃圾邮件了。但机器人至少会填补其中的一些。
How about a human readable question that tells the user to put in the first letter of the value he put in the first name field and the last letter of the last name field or something like this?
Or show some hidden fields which are filled with JavaScript with values like referer and so one. Check for equality of these fields with the ones you have stored in the session before.
If the values are empty, the user has no javascript. Then it would be no spam. But a bot will at least fill in some of them.
当然你应该选择 Honeypot 或 BOTCHA 之一。
Surely you should select one thing Honeypot or BOTCHA.