Skip navigation.

spam

Drupal php code snippet to find stealth spam

Another friend of mine was deeply affected by the stealth-spam problem that I described in the previous page in this booklet.

In order to help them find affected comments, I wrote the following php code snippet for their Drupal 5 web site (the code should work as is for Drupal 6).

<?php
$result = db_query("SELECT c.cid, c.nid, c.uid, c.subject, c.timestamp, u.name, n.title FROM {comments} c
JOIN {users} u ON u.uid = c.uid
JOIN {node} n ON n.nid = c.nid
WHERE c.comment LIKE '%%href%%' AND c.status = 0 ORDER BY c.timestamp DESC");

Strategies for spammers; Understand your ennemy.

Spammers are lazy programmers but one can't deny that they are crafty and cunning.

The spambots they design are often poorly written but it doesn't matter: the spambot is designed to do one very simple task mindlessly, and they do it all across the internet even in places the programmer never intended them to do. But by dint of brute force, they do manage to achieve the desired result in some places.

On the other hand, spammers know perfectly well that we, webmasters are on our guard against spam, and they find ways to put our suspicions to sleep.

Syndicate content