I have a large list of users that registered through a website without any spam filter active during registration.
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.
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>.\r\n";
$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 "\r\n";
}