« I now have a Manhattan, KS phone numberPageFile fustration »

BackOffice Hack to help deal with Trackback spammers

06/12/06

  11:56:01 am, by The Dreamer   , 576 words  
Categories: Stuff, Software

BackOffice Hack to help deal with Trackback spammers

While, I didn't get hit by a lot of new trackback spam overnight, and it wasn't that hard to deal with in the ordinary way. I got to thinking it would be nice if there was some report that I could look at with recent trackbacks to my site, and then apply my back office antispam techniques to.

Where techniques are traditional 'keyword' antispam and the 'byip' hack that I had previously added to my setup.

This is what I came up with:

--- F:\chen-online.net\lawrence\admin\b2stats.php.orig	Tue Sep 13 17:11:02 2005
+++ F:\chen-online.net\lawrence\admin\b2stats.php	Mon Jun 12 11:38:13 2006
@@ -135,6 +135,13 @@
 			echo '<li>';
 		echo '<a href="b2stats.php?show=other&amp;blog=', $blog, '">', T_('Direct Accesses'), '</a></li>';
 
+		if( $show == 'trackbacks' )
+			echo '<li class="current">';
+		else
+			echo '<li>';
+		echo '<a href="b2stats.php?show=trackbacks&amp;blog=', $blog, '">', T_('Trackbacks'),
+'</a></li>';
+
 		?>
 		</ul>
 	</div>
@@ -395,6 +402,46 @@
 	<p><?php echo T_('Total RSS hits') ?>: <?php stats_total_hit_count() ?></p>
 
   <?php
+		break;
+
+		case 'trackbacks':
+		?>
+	<h2><?php echo T_('Last Trackbacks') ?>:</h2>
+	<p><?php echo T_('These are hits from trackbacks from other blog systems to this blog') ?></p>
+	<?php $sql = "SELECT comment_date, comment_author_url, comment_author_IP, comment_author FROM $tablecomments WHERE comment_type='trackback' ORDER BY comment_ID DESC LIMIT 30";
+	$res_tbacks = $DB->get_results( $sql, ARRAY_A );
+  if( count( $res_tbacks ) )
+  { ?>
+	    <table class="grouped" cellspacing="0">
+		<?php>
+		$count = 0;
+		foreach ( $res_tbacks as $row_tbacks ) { ?>
+			<tr <?php if( $count%2 == 1 ) echo 'class="odd"'; ?>>
+				<td class="firstcol"><?php echo $row_tbacks['comment_date']; ?></td>
+				<td><a href="<?php echo htmlentities($row_tbacks['comment_author_url']); ?>">
+				<?php
+					$baseDomain = preg_replace("/https?:\/\//i", "", $row_tbacks['comment_author_url']);
+					$baseDomain = preg_replace("/^www\./i", "", $baseDomain);
+					$baseDomain = preg_replace("/\/.*/i", "", $baseDomain);
+					echo htmlentities($baseDomain); ?></a></td>
+				<?php if( $current_User->check_perm( 'spamblacklist', 'edit' ) )
+				{ ?>
+				<td><a href="b2antispam.php?action=ban&amp;keyword=<?php echo urlencode($baseDomain) ?>" title="<?php echo T_('Ban this domain!') ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo /* TRANS: Abbrev. */ T_('Ban') ?>" title="<?php echo T_('Ban this domain!') ?>" /></a></td>
+				<?php } ?>
+				<td class="right"><?php echo $row_tbacks['comment_author_IP'];
+				if ( $current_User->check_perm( 'spamblacklist', 'edit' ) )
+				{ // We have permission to ban IPs... ?>
+					<a href="b2antispam_byip.php?action=banip&amp;ipaddress=<?php echo urlencode($row_tbacks['comment_author_IP']) ?>" title="<?php echo T_('Ban this IP address!') ?>"><img src="img/noicon.gif" class="middle" alt="<?php echo T_('Ban') ?>" title="<?php echo T_('Ban this IP address!') ?>" /></a>
+				<?php
+				} ?></td>
+				<td><?php echo $row_tbacks['comment_author']; ?></td>
+		</tr>
+		<?php
+		$count++;
+		} // End stat loop ?>
+	    </table>
+  <?php
+  }
 		break;
 
 		case 'other':

1 comment

Comment from: The Dreamer [Member]  

Today, I made two additions to this hack.

  1. Limit results to trackbacks in last 90 days
  2. Display the comment_content in the table, includes making changes to the css to get them to display ‘nicely’.

the code for these changes will be left as an exercise to anybody wanting to make these changes

06/14/06 @ 10:09
Now instead of subjecting some poor random forum to a long rambling thought, I will try to consolidate those things into this blog where they can be more easily ignored profess to be collected thoughts from my mind.

Latest Poopli Updaters -- http://lkc.me/poop

bloglovin

There are 20 years 1 month 23 days 21 hours 20 minutes and 13 seconds until the end of time.
And, it has been 4 years 11 months 3 days 16 hours 42 minutes and 43 seconds since The Doctor saved us all from the end of the World!

Search

November 2017
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Google

Linkblog

  XML Feeds

Who's Online?

  • Guest Users: 0
This seal is issued to lawrencechen.net by StopTheHacker Inc.
free blog tool

hosted by
Green Web Hosting! This site hosted by DreamHost.

monitored by
Monitored by eXternalTest
SiteUptime Web Site Monitoring Service
website uptime