BPOVIA Website Design

Icon

Provides High-quality Web Design And Maintenance Service In The World

Block spams by integrating Ajax Fancy Captcha into your website

Did you ever found that there were constantly spam comments on your websites, and obviously they were sent by robots?  Although Akismet plug-in on your sites can prevent lots of spams, there are still so many spams for it to deal with them all.  Generally, thousands of spams show up on a good blog each day.  To the webmaster, it is indeed a pain in the ass.

Now BPOVIA has figured out one of the efficient verification-checking program which also looks nice.  Here it is: Ajax Fancy Captcha ,This open-source program is based on jQuery which enables itself to coordinate the comment section with all kinds of CMS.  Let ‘s take an example of integrating into WordPress, You can see the preview blow:

Here is steps:

1.Download Ajax Fancy Captcha, and then extract the package.  Pick out the file ajax-fancy-captcha-php, and put it under the dir of WordPress theme(wp-content/theme/Your-Theme/);

2.Put the code blow into your header.php between <head></head> [Note: if you have already include jQuery.js you can remove the firs line.]

<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/ajax-fancy-captcha-php/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/ajax-fancy-captcha-php/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/ajax-fancy-captcha-php/captcha/jquery.captcha.js"></script>
<link href="<?php bloginfo('template_directory'); ?>/ajax-fancy-captcha-php/captcha/captcha.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8">
$(function() {
 $(".ajax-fc-container").captcha({
 borderColor: "silver",
 captchaDir: "<?php bloginfo('template_directory');  ?>/ajax-fancy-captcha-php/captcha/",
 url: "<?php bloginfo('template_directory');  ?>/ajax-fancy-captcha-php/captcha/captcha.php",
 formId: "commentform",
 text: "Verify that you are a human,<br />drag <span>scissors</span> into the circle."
 });
});
</script>

3.Find code of you [submit button] in comments.php add code blow in the front of it.

<div>You must enable javascript to see captcha here!</div>

4. Add the function into  functions.php

function wxq_preprocess_comment($comment) {
 if(!session_id()) session_start();
 if($_POST['captcha'] && $_POST['captcha'] == $_SESSION['captcha']){
 unset($_SESSION['captcha']);
 return($comment);
 } else wp_die( __("Error: please drag the captcha.") );
}
add_action('preprocess_comment', 'wxq_preprocess_comment');

Done!  Your sites will be no longer bothered by the spam robots.  Visitors need to follow the certain instructions to submit the comments which is the barrier that robots can never overcome.

For the other CMS like joomla! or Drupal, you can integrat them the same way!

BPOVIA All Rights Reserved
Maintained by BPOVIA Web Design Team

Category: drupal, Joomla, WordPress

Tagged: , , , , ,

2 Responses

  1. It's good to know that there is a new spam blocking program that can be put on different CMS. Akismet does a great work on controlling those spam comments but I guess Ajax Fancy Captcha does more great. I will try this know :)

  2. Seo Ilakiya says:

    Thanks for u r information

    its very useful