Akismet SPAM Filtering in phpBB3

June 3rd, 2009 Mark 1 comment

Recently I’ve been seeing a shitload of Spambot signups and actual spam postings on my Coopersguns BodyBuilding forums

phpBB 3 had a little spam hiatus whilst the spammers cracked the new captcha system, however it’s obviously been well and truly broken now

I decided to clean the forums up and get rid of the spammers. I have employed 2 techniques:

  1. A phpBB3 mod called daroPL_AntiSpam
  2. Some code I quickly conjured up to check with Akismet when a comment is posted

I will obviously be talking about the latter here, follows are instructions on how to implement the Akismet check on posts:

If you want to copy & paste the following code snippets, hover over them and click the ‘copy’ button

1) Download akismet-php-curl-class
2) Copy the akismet.curl.class.php from the archive to your phpBB3 forum’s ‘includes’ folder (e.g. ~/public_html/forums/includes)
3) Edit message_parser.php in the ‘includes’ folder and make the following changes:

Find:

if (!class_exists('bbcode'))
{
        include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
}

After it, insert the following

if (!class_exists('akismet')) {
        include($phpbb_root_path . 'includes/akismet.curl.class.' . $phpEx);
}

Find:

// Check number of links
if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls'])
{
	$this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], $config['max_' . $mode . '_urls']);
	return (!$update_this_message) ? $return_message : $this->warn_msg;
}

After it, insert the following:

// Akismet SPAM check
if (($user->data['user_posts']<=6) && ($user->data['user_type']==0)) {

	$akismet_comment = array(
	    'comment_type'              => 'comment',
	    'comment_author'            => $user->data['username'],
	    'comment_author_email'      => $user->data['user_email'],
	    'comment_author_url'        => $user->data['user_website'],
	    'comment_content'           => $this->message,
	);

	$akismet = new akismet('YOURAKISMETAPIKEYHERE','http://www.yourforums.com/forums');

	if(!$akismet->error) {

		if($akismet->valid_key()) {

			if($akismet->is_spam($akismet_comment)) {

				$this->warn_msg[] = $user->lang['AKISMET_SPAM'];
				$a_to = "you@youraddress.com";
				$a_subject = "Attempted SPAM Post by ".$user->data['username'];
				$a_body = $this->message;
				$a_headers = "From: admin@yourforums.com";
				mail($a_to, $a_subject, $a_body, $a_headers);

			}

		}

	}

}

4) Edit posting.php in the ‘language/en/’ folder (obviously you’ll need to add this to other languages your users use too)

Find:

        'TOO_FEW_CHARS'                         => 'Your message contains too few characters.',

After it, insert the following:

        'AKISMET_SPAM'                  => 'Your message looks like SPAM.',

5) Finished!

New website created: Cold Steel UK

October 27th, 2008 Mark No comments

Just posting here to get the latest website I’ve produced indexed in Google..

The website is Cold Steel UK – it’s the UK distributors website, for trade and retail. Cold Steel UK sell knives and swords of the highest quality, amongst other things.

The ecommerce system used is Actinic v9 and on the website side, technologies used include jQuery & PHP (via Actinic’s embedded PHP engine)

Categories: Internet, WebDev Tags: , ,

Dropbox File Sync Available & Works With Vista MKLINK Symbolic Links

September 15th, 2008 Mark 1 comment

Just a quick post about Dropbox – it’s now out of beta and anyone can sign up.. I just have and I was pretty glad to find out that you don’t need to copy all your stuff into the folder that Dropbox creates on each machine (at least with Vista).

If you’re using Vista, navigate to your Dropbox folder via the command line and type:

mklink

e.g.

mklink CM2004 c:\projects\cm2004

Now Dropbox is happily syncing away as if the folder had just been copied into the Dropbox folder

Google Chrome

September 3rd, 2008 Mark No comments

Crashed and burned!

Categories: Internet, Windows Tags:

How to stop Quicktime hijacking audio/mpeg (mp3) in Firefox

August 27th, 2008 Mark 14 comments

This frustrated the shit out of me. My setup: Vista Business SP1, Firefox 3.0.1, Quicktime 7.5 (861).

No matter how hard I tried, besides disabling the Quicktime plugin in Vista, moving/deleting npqtplugin4.dll in the Firefox plugins folder or hex editing it, Firefox 3.0.1 would always play any mp3s I clicked in a full screen Quicktime plugin.

The about:plugins shows the following:

QuickTime Plug-in 7.5 (861)

File name:
npqtplugin4.dll
The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
MIME Type Description Suffixes Enabled
video/mpeg MPEG media mpeg,mpg,m1s,m1v,m1a,m75, m15,mp2,mpm,mpv,mpa Yes
audio/mpeg MPEG audio mpeg,mpg,m1s,m1a,mp2,mpm, mpa,m2a Yes
audio/x-mpeg MPEG audio mpeg,mpg,m1s,m1a,mp2,mpm, mpa,m2a Yes
video/3gpp 3GPP media 3gp,3gpp Yes

How the hell do you change one of those values to say “enabled: no”?

Changing Mime Type associations in Firefox via Options -> Applications does nothing – Quicktime always gets there first

Changing Mime Settings in Quicktime Preferences launches Vista’s Set Program Associations which is also fruitless

After much digging around, I have worked out that the following will let you handle audio/mpeg (mp3) the way you want:

  • Go to about:config
  • Type ‘plugin’ in the filter box (minus quotes)
  • Look for ‘plugin.disable_full_page_plugin_for_types’
  • If it already exists and contains a value, add ‘,audio/mpeg’ to the end of it, otherwise just change the value to ‘audio/mpeg’
  • Fully close Firefox, wait a few seconds for it to clean up and die
  • Launch Firefox again.. click an MP3 link.. voila! it does whatever you’ve specified in your Firefox Options -> Applications
Categories: Windows Tags: , , , , ,

Apache2 Won’t Properly Stop

July 9th, 2008 Mark No comments

Just a quick note:

Apache 2.2 with PHP 5.2.6-2 on Debian fails to shutdown properly on one of my servers

apache2ctl stop or /etc/init.d/apache2 stop or equivalents would result in “waiting…………….” until a timeout and then the new process is launched anyway which fails because the port is already in use, apache2 never finished shutting down properly

Not sure exactly what the problem is, but downgrading to PHP 5.2.6-0.dotdeb.1 via DotDeb mirrors solved the issue

Hopefully it will be fixed in the next version/patch

Categories: Linux, SysAdmin Tags: , ,

Velocity Diet Results

May 29th, 2008 Mark No comments

It’s day 1 of the transition out of the Velocity Diet – the 28 day diet has been completed!

Final Measurements (cold, not flexed):

Bicep: 14.5″ (-0.5″)
Calf: 16.25″ (-0.75″)
Thigh: 22.25″ (-1.75″)
Neck: 14.75″ (-0.75″)
Forearm: 12.5″ (-0.25″)
Waist: 32″ (-4.5″)
Lower Abs: 36″ (-4″)
Chest: 39″ (-2″)

Total inches lost: 14.5″

Weight: 206lbs (14st 10lbs) / 93.4Kg

Total weight lost: 16lbs / 7.2Kg

I am now within 10lbs of my original goal for summer, I’m predicting around 6 weeks to get there. I will transition from the Velocity Diet onto T-Dawg Diet 2.0

Overall I’m very pleased with the 16lbs loss and it’s very noticable

Categories: Health Tags:

Velocity Diet Day 28

May 28th, 2008 Mark No comments

The last day before the transition!

Measurements haven’t changed since last time:

Today’s Measurements (cold, not flexed):

Bicep: 14.25″ (-0.75″)
Calf: 16.25″ (-0.75″)
Thigh: 22.25″ (-1.75″)
Neck: 14.75″ (-0.75″)
Forearm: 12.5″ (-0.25″)
Waist: 32″ (-4.5″)
Lower Abs: 36″ (-4″)
Chest: 39″ (-2″)

Weight: 207lbs (14st 11lbs) / 93.8Kg (-15lbs / 6.8Kg)

I will post my immediate post Velocity Diet figures tomorrow and then some post transition figures a further 2 weeks later

I am happy with the results thus far, I hoped to lose 14lbs and have exceeded that

My ultimate target has been 196lbs @ 8% body fat (assuming I’ve calculated everything properly!).. hopefully I’ll be there within 6 weeks

Here’s my original fat loss estimate chart for 2008 just for fun

Categories: Health Tags:

Velocity Diet Day 26

May 26th, 2008 Mark No comments

Nearly there – 3 full days to go

Today’s Measurements (cold, not flexed):

Bicep: 14.25″ (-0.75″)
Calf: 16.25″ (-0.75″)
Thigh: 22.25″ (-1.75″)
Neck: 14.75″ (-0.75″)
Forearm: 12.5″ (-0.25″)
Waist: 32″ (-4.5″)
Lower Abs: 36″ (-4″)
Chest: 39″ (-2″)

Weight: 208lbs (14st 12lbs) / 94.3Kg (-14lbs / 6.3Kg)

I think that my weight is due for a couple of pounds drop over the next couple of days. 14 pounds was my target so I’ve reached that already!

Categories: Health Tags:

Velocity Diet Day 22

May 22nd, 2008 Mark No comments

End of week 3

Weight: 209lbs (14st 13lbs) / 94.8Kg (-13lbs / 5.9Kg)

Categories: Health Tags: