Skip navigation.

php code snippet

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");

Syndicate content