Elliot Haughin

Weblife

Thoughts

Tunes

  • 2009/01/05Hillsong – Stronger
  • 2009/01/05Hillsong – High And Lifted Up
  • 2009/01/05Hillsong – He Is Lord
  • 2009/01/05Hillsong – This Is Our God
  • 2009/01/05Hillsong – Desert Song
  • 2009/01/05Hillsong – Run
  • 2009/01/05Hillsong – Run
  • 2009/01/05Hillsong – Home
  • 2009/01/05Hillsong – Run
  • 2009/01/05Hillsong – Home

Akismet CodeIgniter Library

Akismet is a remotely hosted spam-busting web service.
If you have a CodeIgniter application that accepts comments from users, Akismet can help you filter out the ’spam’ comments and keep the ‘real’ comments.

Akismet Logo

We can’t stand spam.

Who can? You have better things to do with your life than deal with the underbelly of the internet. Automattic Kismet (Akismet for short) is a collaborative effort to make comment and trackback spam a non-issue and restore innocence to blogging, so you never have to worry about spam again.

To use the library, you’ll need to get an Akismet API Key

Download the library and put it in your application/libraries/ directory, then place code like this in your controller:

$this->load->library('akismet');
 
$comment = array(
'author'	=> $this->input->post('name'),
'email'		=> $this->input->post('email'),
'website'	=> $this->input->post('website'),
'body'		=> $this->input->post('comment')
);
 
$config = array(
'blog_url' => 'http://www.yoursite.com/',
'api_key' => 'yourapikeyhere',
'comment' => $comment
);
 
$this->akismet->init($config);
 
if ( $this->akismet->errors_exist() )
{				
	if ( $this->akismet->is_error('AKISMET_INVALID_KEY') )
	{
	log_error('AKISMET :: Theres a problem with the api key');
	}
	elseif ( $this->akismet->is_error('AKISMET_RESPONSE_FAILED') )
	{
	log_error('AKISMET :: Looks like the servers not responding');
	}
	elseif ( $this->akismet->is_error('AKISMET_SERVER_NOT_FOUND') )
	{
	log_error('AKISMET :: Wheres the server gone?');
	}
 
	// If the server is down, we have to post the comment :(
	$this->_post_comment($comment);
	$this->load->view('thankyou');
}
else
{
	if ( $this->akismet->is_spam() )
	{
		$this->load->view('spam');
	}
	else
	{
		$this->_post_comment($comment);
		$this->load->view('thankyou');
	}
}

Download Akismet CodeIgniter Library

Version: 1.0

Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008Christmas 2008