使用 akismet 检测注册垃圾邮件发送者 [英] Registration spammer detection with akismet

查看:21
本文介绍了使用 akismet 检测注册垃圾邮件发送者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大量通过网站注册的用户列表,在注册期间没有任何垃圾邮件过滤器处于活动状态.

I have a large list of users that registered through a website without any spam filter active during registration.

我想区分哪些注册用户可能是垃圾邮件发送者.我正在尝试使用 akismet 来执行此操作,但到目前为止 akismet 告诉我所有用户都不是垃圾邮件发送者.可能是因为 akismet 确实是为评论而制作的,而这些评论在注册期间不可用.

I would like to distinguish which registered users are likely spammers. I'm trying to use akismet to do this but so far akismet is telling me all users are not spammers. Probably since akismet really is made for comments, which aren't available during registration.

我要发送的 akismet 是用户名、电子邮件.对于 url,我使用电子邮件域.对于他们的评论,我使用:我是来自 $domain 的 $username,在 $date 注册,电子邮件 $email 和网站 $url".

What I'm sending akismet is the username, email. For url I use the email domain. For their comment, I use: "Hi, I'm $username from $domain registered on $date with email $email and website $url".

然而,如上所述,即使用户看起来像垃圾邮件发送者,它也始终返回有效用户.

This however, like said, always returns valid users even if the user looks like a spammer.

如果您对完整代码感兴趣:

If you're interested in the full code:

<?php

// bring php process to this dir
chdir(dirname(__FILE__));


// include Joomla Framework
require('../bootstrap-joomla.php');

// akismet class
require('akismet.class.php');

/**
 * Retrieves users not yet validated
 */
function getUsers($userid, $limit = 10) {
  global $database;
  $database->setQuery("SELECT * FROM jos_users WHERE akismet_validated = 0 LIMIT " . intval($limit));
  $Users = $database->loadObjectList();
  return $Users;
}

/**
 * sets the validation results for the user
 */
function saveValidationResult($userid, $spammer) {
  global $database;
  $database->setQuery("UPDATE jos_users set akismet_validated = 1, akismet_spammer = " . intval($spammer) . " WHERE id = " . $userid . " LIMIT 1");
  return $database->query();
}

// get non validated users
$Users = getUsers();

// validate each user
foreach($Users as $User) {
  list($user, $domain) = explode('@', $User->email);

  $name = $User->username;
  $email = $User->email;
  $url = $domain;
  $comment = "Hello, I am $name, registered on $User->registerDate from <a href="$url">$url</a>.
";


  $akismet = new Akismet('http://www.fijiwebdesign.com/', 'c511157d1d98');
  $akismet->setCommentAuthor($name);
  $akismet->setCommentAuthorEmail($email);
  $akismet->setCommentAuthorURL($url);
  $akismet->setCommentContent($comment);
  //$akismet->setPermalink('http://www.fijiwebddesign.com/');


  echo "$User->id, $User->username : ";
  if($akismet->isCommentSpam()) {
    saveValidationResult($User->id, true);
    echo "Spammer";
  } else {
    saveValidationResult($User->id, false);
    echo "Not Spammer";
  }

  echo "
";
}

推荐答案

最好将 Akismet 视为一个巨人 贝叶斯垃圾邮件过滤器以及其他一些启发式方法.它适用于帖子的内容、帖子的时间,最重要的是,它看到被报告为垃圾内容的类似内容的频率.您提供给它的字符串有些独特,因此其他人不会对其进行垃圾邮件教育.即使您确实以某种方式将该字符串标记为垃圾邮件,您最终也会得到一大堆误报,因为您只是通过它提供所有 用户帐户.

It's best to think of Akismet as a giant Bayesian spam filter with some other heuristics. It works on the contents of a post, the timing of a post, and most importantly, how frequently it's seen similar content that has been reported as spammy. The string you're feeding to it is somewhat unique, so others will not have educated it on spammyness. Even if you did somehow mark that string as spammy, you'd end up with a whole bunch of false positives because you're just feeding all of the user accounts through it.

如果您认为您的网站上可能有非法用户,而他们没有参与,只需删除注册即可.如果他们是合法的,他们可以简单地重新注册.

If you believe that you may have illegitimate users on your site, and they have not participated, simply delete the registration. If they are legitimate, they can simply re-register.

如果用户参与了,只需查看他们的贡献.他们的垃圾邮件应该很明显.

If the users are participating, simply look at their contributions. Their spammyness should be obvious.

这篇关于使用 akismet 检测注册垃圾邮件发送者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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