实施“报告此内容"并检测垃圾邮件发送者或机器人触发的事件 [英] Implementing "Report this content" and detecting spammer or robot triggered event

查看:51
本文介绍了实施“报告此内容"并检测垃圾邮件发送者或机器人触发的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为网站创建一个论坛,并计划实施报告此内容"功能.

I'm creating a forum for a website, and plan on implementing a "Report this content" function.

老实说,我不确定该功能有多大用处(必要的),因为发帖需要用户帐户(由管理员创建),但我对解决方案很感兴趣.

In all honesty, I'm not sure how useful (lit. necessary) the feature will be, since a user account (created by admin) will be required for posting, but the solution interests me.

简而言之,这就是场景:

So in short, this is the scenario:

对于所有用户,都可以只读访问论坛上的所有(不受限制的)内容.对于身份不明的用户,将有一个回复按钮并报告此内容按钮.前者将继续需要登录,而我原计划后者不会,以便任何人都能够标记可疑或冒犯性的内容.

For all users, there will be read-only access to all (non-restricted) content on the forum. For unidentified users there will be a reply button and report this content button present. The former will proceed to require a login, while I had planned that the latter wouldn't, so that anyone would be able to flag suspicious or offensive content.

我因此面临的问题基本上是机器人点击",或者更确切地说,如何实施系统以免被机器人点击"所迷惑.

The problem I'm thus facing is basically "robot clicks", or rather how to implement the system so it won't be fooled by "robot clicks".

想到了几种方法:

1) 用户代理
2)在以任何方式做出反应之前需要几个标志(在预定义的时间跨度内?)
3)robots.txt
4) 需要人工输入第二种形式(验证码或指定原因")

1) User-agent
2) Requiring several flags (in a predefined timespan?) before reacting in any way
3) robots.txt
4) Requiring human input on a second form (captcha or "specify reason")

我对他们的看法:

1) 不可靠(作为唯一解决方案)
2)这需要大量用户,这可能导致事件永远不会被触发
3)这可能是正确"的方式,但只适用于尊重它的人
4) 嗯,我讨厌验证码,需要一个理由可能会提高门槛而无法保持功能有用

1) Unreliable (as sole solution)
2) This requires a mass of users which might lead to the event never being triggered
3) This is probably the "right" way to go, but will only work for those who respect it
4) Meh, I hate captcha and requiring a reason might raise the bar too high to keep the function useful

(高度开明的)社区必须与我分享哪些方法?

What methods would the (highly enlightened) community have to share with me?

推荐答案

您可以使用 javascript 的 appendChild(); 将报告此"

附加到 DOM代码>.

You could append the 'report this' <form> to the DOM with javascript's appendChild();.

这样可以防止大量垃圾邮件.

This would prevent a lot of spam.

它还可以防止未运行 javascript 的用户看到报告按钮.但由于这是一项不会妨碍用户体验的功能,因此它可能是一个可以接受的选项.

It would also prevent users not running javascript from seeing the report button. But since this is a feature that does not hinder the user-experience, it is probably an acceptable option.

window.onload = function() {
    var f = document.createElement('FORM');
        f.method = 'post';
        f.action = 'report.cgi';

    var b = document.createElement('INPUT');
        b.type = 'submit';
        b.value = 'Report this';


        f.appendChild(b);
        document.body.appendChild(f);
 }

注意:
rel="nofollow" 属性确保搜索引擎不会计算"链接,但会遵循它(是的,名称的含义不同).

Note:
The rel="nofollow" attribute makes sure search engines do not 'count' the link, they do however follow it (yes, the name suggests differently).

如果你不希望搜索引擎接触某个文件,使用robots.txt

If you want the search engines not to touch a certain file, use robots.txt

注意 2:
报告某事是在服务器上改变​​"某事的操作.因此,它不应该是 GET 请求,而是应该是 POST 请求.换句话说:不要使用 而是提交带有 method 参数集的 发布".

Note 2:
Reporting something is an action that 'changes' something on the server. Thus, it should not be a GET request Instead it should be a POST request. In other words: do not use a <a href""> but instead submit a <form> with its method argument set to "post".

这篇关于实施“报告此内容"并检测垃圾邮件发送者或机器人触发的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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