Kill Drupal Trackback Spam: The quick and dirty way

04.30.2005

Aldon Hynes created this simple php script to erase trackback spams in drupal. To use it, simply create a new node and paste the PHP code I've included below. To run the script simply access the node. One click and 800 trackback spams destroyed. Take that JRCreations.

<?php

$sql = " where ";

$sql .= " subject like '%cialis%' or ";$sql .= " comment like '%cialis%' or ";

$sql .= " subject like '%fioricet%' or ";$sql .= " comment like '%fioricet%' or ";

$sql .= " subject like '%Casinos%' or ";$sql .= " comment like '%Casinos%' or ";

$sql .= " subject like '%jrcreations%' or ";$sql .= " comment like '%jrcreations%' or ";

$sql .= " comment like '%tramadol%' or ";$sql .= " subject like '%tramadol%' or ";

$sql .= " comment like '%propecia%' or ";$sql .= " subject like '%propecia%' or ";

$sql .= " comment like '%allegra%' or ";$sql .= " subject like '%allegra%' or ";

$sql .= " comment like '%levitra%' or ";$sql .= " subject like '%levitra%' or ";

$sql .= " comment like '%adipex%' or ";$sql .= " subject like '%adipex%' or ";

$sql .= " comment like '%phentermine%' or ";$sql .= " subject like '%phentermine%' or ";

$sql .= " comment like '%soma%' or ";$sql .= " subject like '%soma%' or ";

$sql .= " comment like '%poker%' or ";$sql .= " subject like '%poker%' or ";

$sql .= " comment like '%online casino%' or ";$sql .= " subject like '%online casino%' or ";

$sql .= " comment like '%5e4b5a4%' or ";$sql .= " subject like '%5e4b5a4%' or ";

$sql .= " comment like '%dir.web-marketings.com%' or ";$sql .= " subject like '%dir.web-marketings.com%' or ";

$sql .= " subject like '%8532a.com%' or ";$sql .= " comment like '%8532a.com%' or ";

$sql .= " subject like '%http://827.com%' or ";$sql .= " comment like '%http://827.com%' or ";

$sql .= " subject like '%http://shaffelrecords.com%' or ";$sql .= " comment like '%http://shaffelrecords.com%' or ";

$sql .= " subject like '%http://dawsonanddadrealty.com%' or ";$sql .= " comment like '%http://dawsonanddadrealty.com%' or ";

$sql .= " subject like '%http://kenwoodexcelon.com%' or ";$sql .= " comment like '%http://kenwoodexcelon.com%' or ";

$sql .= " subject like '%xxuz.com%' or ";$sql .= " comment like '%xxuz.com%' or ";

$sql .= " comment like '%Yellow Monkey%' or ";$sql .= " subject like '%Yellow Monkey%' or ";

$sql .= " comment like '%rape porn%' or ";$sql .= " subject like '%rape porn%' or ";

$sql .= " comment like '%holdem%' or ";$sql .= " subject like '%holdem%' or ";

$sql .= " comment like '%hold''em%' or ";$sql .= " subject like '%hold''em%'";

$ssql = "SELECT * from {comments} " . $sql ; $result = db_query($ssql);

while($comment = db_fetch_object($result)) {   print $comment->cid."<br>";   _comment_delete_thread($comment);}

$sql = str_replace('comment like','excerpt like', $sql);

$dsql = "DELETE FROM {trackback_received} " . $sql ;

$result = db_query($dsql);

?>

Comments

Disabled Trackback all together

I found the entire trackback module and its lack of integration with SPAM / AKISMET a total pain to work with. On a given day I get over 800 trackbacks, making it an absolute pain to delete, review for any legit trackbacks. How do other cope with this level of SPAM in trackbacks? I would love for a solution to this for Drupal.

Quickly delete loads of spam

To quickly delete loads of spam, consider the following. DELETE FROM trackback_received WHERE site LIKE "85.255.113.%";

*gurgle*

So much for line break formatting. The HTML editor finally loaded on this try. :-o it's why I don't use it.

Yeah, I best turn it off; it

Yeah, I best turn it off; it takes entirely too much bandwidth, anyhow.

Another method.

With Drupal 4.6.x, install the Trackback and Spam modules - as well as your DBA module. Configure both such that trackbacks must be approved. When going through your approval trackbacks, open the ones you wish to approve in new tabs and approve them (assuming you're using Mozilla/Firefox). When you have completed the list, open the database administration module, select 'Run Script', and paste this in. DELETE FROM `trackback_received` WHERE `status` = "0"; This zaps any and all trackbacks that have not been published. Works like a charm.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.