开发者

How to avoid repeated post submissions?

I have a for开发者_Python百科m 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?


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜