Leaving this post here for archival purposes – but the latest version of the subscribe to comments script is now in cgi format – find more info here
So just to give you some history on the problem I was having. As comment SPAM has been coming in, as well as deleting them as quickly as I can (of course) I've been adding the IPs to my list of banned IPs in MT. The one kicker was that sometimes, while the comment would not appear on the site, I was getting the "comment notification" from the subscribe to comments script.
Took me awhile to figure it out, but what was happening was these types of comments were coming from people who I had already banned through MT, but my subscribe to comments script didn't know that and would send out the notifications. MT would block the comment from actually appearing on the site, but whoever was subscribed to the post would get the SPAM. I don't know how many of you have run into this problem, but I'll post what you need to do to fix it…
Go to where you uploaded your subscribe to comments scipt files and find the one called "functions.php". Make a backup of it (always a good thing to do) and open it up. Find the function called "post_comment()" – the function starts with this line:
function post_comment() {
what you want to do is skip past just after these lines:
$blogname= stripslashes($blogname);
$author= stripslashes($author);
$text = stripslashes($text);
$title = stripslashes($title);
and add the following (with modifications noted below)
mysql_connect ("localhost", "DATABASE-USERNAME", "DATABASE-PASSWORD");
mysql_select_db("MT-DATABASE");
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ipbanreslt = mysql_query("SELECT ipbanlist_ip FROM mt_ipbanlist WHERE '".$ip."' LIKE ipbanlist_ip");
$num_rows_ip = mysql_num_rows($ipbanreslt);
if ($num_rows_ip > 0) {
$emailbody = "AUTHOR: $author\nURL OF POST: $link\nCOMMENT:\n $text\nIP: $ip\nEMAIL: $email\nURL: $url";
mail("YOUREMAIL@EMAIL.COM","[$blogname] IP WARNING on $title",$emailbody,"From: YOUREMAIL@EMAIL.COM");
echo "<html><head><title></title><meta http-equiv=\"refresh\" content=\"0;URL=http://www.fbi.gov/homepage.htm\"></head><body></body></html>";
exit;
}
What this will do is send you an email that a spammer tried to hit your site. It has the potential to SPAM your inbox, but I like to know what's going on and that the script is working. If you don't want these emails just add a // before the mail("youremail@email.com", etc… line.
As for the redirect to the FBI site – heh – that's just me having some fun. I figure if I'm a spammer, and I spam a site, and I'm suddenly on the FBI homepage, I'd get a little freaked out. You can change that URL to anything you feel like it. Basically I'm just making them go away. I'm not bringing them back to my site after their comment is denied.