看起来我们将为Stack Overflow添加CAPTCHA支持。这对于防止机器人、垃圾邮件发送者和其他恶意脚本活动是必要的。我们只希望人类在这里发布或编辑东西!

我们将使用JavaScript (jQuery)验证码作为第一道防线:

http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs

这种方法的优点是,对于大多数人来说,CAPTCHA永远不会可见!

然而,对于禁用JavaScript的人,我们仍然需要一个备用方案,这就是棘手的地方。

我为ASP编写了一个传统的CAPTCHA控件。NET,我们可以重复使用。

但是,我更倾向于使用一些文本化的东西,以避免为每个请求在服务器上创建所有这些图像的开销。

我见过这样的事情…

ASCII文本验证码:\/\/(_)\/\/ 数学难题:7减3乘以2等于多少? 小问题:癞蛤蟆和冰棍,哪个更好吃?

也许我只是在风车这里倾斜,但我希望有一个更少的资源密集型,非图像为基础的<noscript>兼容的验证码,如果可能的话。

想法吗?


当前回答

简单的文字听起来很棒。贿赂社区来做这项工作!如果您像我一样相信,SO代表积分可以衡量用户帮助网站成功的承诺,那么提供声誉积分来帮助网站免受垃圾邮件发送者的侵害是完全合理的。

Offer +10 reputation for each contribution of a simple question and a set of correct answers. The question should suitably far away (edit distance) from all existing questions, and the reputation (and the question) should gradually disappear if people can't answer it. Let's say if the failure rate on correct answers is more than 20%, then the submitter loses one reputation point per incorrect answer, up to a maximum of 15. So if you submit a bad question, you get +10 now but eventually you will net -5. Or maybe it makes sense to ask a sample of users to vote on whether the captcha questionis a good one.

最后,就像每日信誉上限一样,假设没有用户可以通过提交验证码问题获得超过100个声誉。这是对此类贡献的权重的合理限制,也有助于防止垃圾邮件发送者在系统中植入问题。例如,你可以选择与提交者的声誉成比例的概率而不是相等概率的问题。乔恩·斯基特,请不要提交任何问题。

其他回答

虽然类似的讨论开始了:

我们正在一个经常进行数据挖掘的应用程序上尝试这个解决方案:

一个更好的验证码控制(看妈-没有图像!)

你可以在我们的建筑检查搜索中看到它的作用。

您可以查看Source并看到CAPTCHA只是HTML。

我一直在使用http://stopforumspam.com作为对抗机器人的第一道防线。在我已经实现的网站上,它可以阻止几乎所有的垃圾邮件发送者,而不使用验证码。

如何显示9个随机的几何形状,并要求用户选择两个正方形,或两个圆或其他。应该很容易写,也很容易使用。

没有什么比你无法正确阅读短信更糟糕的了……

有人还建议使用Raphael JavaScript库,它显然可以让你在所有流行的浏览器的客户端上作画:

http://dmitry.baranovskiy.com/raphael/

.. 但这并不完全适用于我的<noscript>情况,不是吗?:)

我必须承认我没有对抗垃圾邮件机器人的经验,也不知道它们有多复杂。也就是说,我在jQuery文章中没有看到任何不能纯粹在服务器上完成的事情。

要改写jQuery文章的摘要:

When generating the contact form on the server ... Grab the current time. Combine that timestamp, plus a secret word, and generate a 32 character 'hash' and store it as a cookie on the visitor's browser. Store the hash or 'token' timestamp in a hidden form tag. When the form is posted back, the value of the timestamp will be compared to the 32 character 'token' stored in the cookie. If the information doesn't match, or is missing, or if the timestamp is too old, stop execution of the request ...

如果您希望使用传统的图像CAPTCHA,而不需要在每个请求上生成它们,那么另一种选择是离线预生成它们。然后你只需要随机选择一个来显示每个表单。