如何避免帖子重复提交?

发布于 2024-12-01 20:37:41 字数 104 浏览 5 评论 0原文

我有一个允许用户粘贴输入的表单,就像 StackOverflow 上的那样。但如果用户知道我发送到服务器的格式,他们就可以继续向我发送请求。如何确保是真实用户发送请求而不是某种机器攻击插入信息?

I have a form that allows users to paste input, like on StackOverflow. But if users know the format I send to the server, they can keep sending requests to me. How can I ensure it is a real user sending a request instead of some kind of machine attack to insert information?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

浅暮の光 2024-12-08 20:37:41

有很多方法可以做到这一点,并且使用多种不同的东西是防止垃圾邮件的好主意。

stackoverflow 的做法(根据我的经验)是,如果发帖量异常,或者帖子很短,或者其他东西有点可疑,那么他们就会使用验证码。

您可以使用 cookie 来监控这一点,例如监控帖子之间的时间是某人正在发送垃圾邮件的一个很好的指标。同样,如果发布的消息的长度都大致相同,或者包含相同的网址/链接或其他内容,您也可以显示验证码来测试用户是否是人类。

There are a load of ways to do this and employing a large variety of different things is a good idea to protect against spam.

What stackoverflow does (from my experience) is if there is an abnormal amount of posting, or maybe the posts are very short, or something else is a bit suspicious then they use a capcha.

You can monitor this by using cookies, for instance monitoring the time between posts is a good indicator that someone is spamming. Similarly if the lengths of the messages posted are all about the same length, or include the same url/link or something you can also display a capcha to test if the user is a human or not.

离旧人 2024-12-08 20:37:41

您可以使用验证码。这可能是最常见的方法。

You can use a captcha. That's probably the most common approach.

神爱温柔 2024-12-08 20:37:41

有不同的技术可以让您或多或少地成功实现这一目标。使用验证码是许多网站使用的一种流行方式。

There are different techniques allowing you to achieve this with more or less success. Using a Captcha is one popular way used by many sites.

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