Simple techniques for preventing spamming of a web chat application

ⅰ亾dé卋堺 提交于 2019-12-11 06:07:44

问题


I have a simple, custom rolled chat here: ( http://ninjawars.net - essentially: ajax chat, php backend, javascript listing of chat messages, logged-in user input only ) that suffers from being able to be spammed. What are some simple systems to prevent spamming of a chat?

One thing (lowest level of protection) that I have already implemented:

  • Ignore consecutive duplicate messages from the same user.

Other ideas that I have:

  • Add consecutive messages from the same user together, instead of creating a separate message line. (relatively simple to implement, decreases the effect of spam but doesn't prevent it)
  • Prevent continued messages after a certain number of consecutive messages from one user, for new users. (relatively simple to implement)
  • Chat moderation by trusted users (complex to implement).

Are there any simple systems/algorithms to prevent chat message spamming that I should know about?


回答1:


Put an increasing delay on how fast a user can reply. So after each message post store next_reply_time as a timestamp of NOW + 1 second. If they reply before the time has reached, ignore it and give a "Reply too fast" warning and set the next_reply_time to NOW + 2 seconds, and so on. This way if they stack up messages too fast, you'll ignore them for longer periods of time. This delay can of course be based on reputation.



来源:https://stackoverflow.com/questions/7452395/simple-techniques-for-preventing-spamming-of-a-web-chat-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!