处理联系表单的最佳做法是什么? [英] What's the best-practice way to process a contact form?

查看:149
本文介绍了处理联系表单的最佳做法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来我每周都会为某人或另一个人编写联系表单。我已经开发了一个验证/邮件客户端/邮件谢谢/保存到数据库/感谢页过程,这是相当强大的,但我想知道其他人有什么经验来执行这个最常见的网站任务?

解决方案

我会给你的最好提示是想出一个防止垃圾邮件的好方法。我们使用蜜罐技术,我们发现它非常有效,实现起来也非常简单。它涉及到两个额外的文本字段添加到每个表单,由CSS隐藏。其中一个字段(在input1中调用)将具有一个设置值,您可以在处理页面上检查该值,另一个字段(input2)将其值留空。很多自动垃圾邮件都会使用一个bot来检测表单的存在并自动填充所有表单域。使用我们的技术,只需通过检查input1仍然具有初始值并且input2仍然具有值,我们就可以猜测表单不是由bot或类似的自动填充的。我们确实有更先进的技术来检查每个领域的内容,但作为一个简单的技巧,这是一个真正的赢家,几乎完全消除了自动联系表单垃圾邮件。


It seems I'm coding contact forms for someone or another every week. I've developed a validate/mail client/mail thankyou/save to DB/thankspage process that's fairly robust but I was wondering what lessons others have for performing this most common of website tasks?

解决方案

the best hint I would give you is to come up with a good way to prevent spam. We use a honeypot technique which we find very effective and is also very simple to implement. It involves the addition of two extra text fields to each form, hidden by CSS. One of these fields (lets call in input1) will have a set value which you can check for on your processing page, the other field (input2) will have its value left empty. A lot of automated spam will use a bot that will detect the presence of a form and autofill all form fields. With our technique, simply by checking that input1 still has its initial value and that input2 still has a value of "" we can guess the form was not autofilled by a bot or similar. We do have more advanced techniques for checking the content of each field but as a simple trick this one is a real winner and has almost completely eradicated automated contact form spam.

这篇关于处理联系表单的最佳做法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆