Category Archives: Web Development

How to use reCAPTCHA on your website? Example

What is CAPTCHA?

CAPTCHA is very important tool to prevent your website from SPAM. CAPTCHA script asks your user to enter some random words which can only identified by human eye.

Why Use CAPTCHA?

If you have any HTML form on your website, where people can submit information. You need to have CAPTCHA to stop auto submission from a bot. Some examples of forms are comment form or User Registration form. CAPTCHA script saves the HTML forms from auto submissions and save it from SPAM.

How to integrate reCAPTCHA?

reCAPTCHA is a CAPTCHA service offered by Google Inc. reCAPTCHA is best CAPTCHA service offered anywhere and it is free to use. Below is the guide to use reCAPTCHA at your website.

Check out the example of Recaptcha. You can download the source code from here.

Step 1: Sign up for Recaptcha

Go to Recaptcha and Sign up for reCAPTCHA service. You need to have Google account to use this service.

Step 2: Register your Website

You need to register your website for reCAPTCHA service. Go to https://www.google.com/recaptcha/admin/create and create keys for your domain. You will get public and private key for your domain.

Step 3: Client Side Integration

Recaptcha provides you several means to integrate it at your website. I am using AJAX API to use it.

Include recaptcha ajax javascript inside your head tag

[cc lang=”javascript”]

[/cc]

Then before your submit button use this code :
[cc lang=”javascript”]

[/cc]

We need to validate the user’s response. So include the validate function onSubmit call of your form.
Below is the validateCaptcha method which you can use to validate Captcha entered by user.
[cc lang=”javascript”]
function validateCaptcha()
{
challengeField = $(“input#recaptcha_challenge_field”).val();
responseField = $(“input#recaptcha_response_field”).val();

var html = $.ajax({
type: “POST”,
url: “verify.php”,
data: “recaptcha_challenge_field=”+Recaptcha.get_challenge()+”&recaptcha_response_field=”+ Recaptcha.get_response(),
async: false
}).responseText;

if(html == “success”)
{
$(“#captchaStatus”).html(” “);
// Uncomment the following line in your application
return true;
}
else
{
$(“#captchaStatus”).html(“Your captcha is incorrect. Please try again”);
Recaptcha.reload();
return false;
}
}
[/cc]

Step 4 : Server Side Integration

Download the PHP Recaptcha lib and store it on your server.

Here is the code to verify the user’s input. You can create a separate file on your server.
[cc lang=”php”]
is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die (“The reCAPTCHA wasn’t entered correctly. Go back and try it again.” .
“(reCAPTCHA said: ” . $resp->error . “)”);
} else {
echo ‘success’;
}
?>
[/cc]

Thats it. Your Recaptcha is working. Try out a Demo of Recaptcha.

How to publish an article in wordpress

I am specifically writing this blog for our guest bloggers who are unfamiliar with WordPress. Here, I am going to present you the simple steps through which you can write and submit your articles at iTechFreak or any other WordPress website where you have the permission to publish the article.

Step 1 : Register at iTechFreak

Go to Guest Post Registration Page. It will ask you for username and email address. Simply enter the username you desire and your email address.

Wordpress Register Image

You will receive an email from us containing your username and password. You can login in the website and submit your article.

Step 2: Complete your profile

After you login we will need some certain details from you. Please fill up all the details and do not forget to fill out Biographical Info. This is the area where you can tell more about yourself and can add a link to your business.

Step 3: Fill out your Adsense information

If you have an adsense account, you need to fill out your adsense information. We share 100% of adsense revenue with our guest posters.

  1. Click on dashboard and go to My Advertising
  2. Enter your publisher ID in “Advertising ID” column
  3. Next you have to enter the Ad slot ID. We recommend you to create new adsense ads for our website, so that you can measure the performance. Create a new adsense advertisement and enter your Ad slot ID, value of “google_ad_slot” in the javascript.

    For example,
    if your adsense code is

    google_ad_client = “pub-XXXXXXXXXXXXXXX”;
    google_ad_slot = “6355805927”;
    google_ad_width = 728;
    google_ad_height = 90;

    The your Ad slot ID is 6355805927.

    Click to open image

  4. Since we allow two ad slots per article. You need to create two different ads and enter the Ad cods in the box.

Step 4: Post your article in WordPress

Click on Posts -> Ad New and then you are all set to enter your post. We recommend to write the post in Microsoft Word and the submit the article later.

Check out these images for how to publish article in wordpress.

Click to open image

  1. Click on Add new and a new page will open
  2. Add Article title and article body
  3. Select the appropriate category for your article.
  4. Add tags to your article. Tags are the keywords related to your website.
  5. Fill the Details in All in SEO Pack Box

Click to open image

This is it. Just hit the submit for review button. We will review your article quickly and publish it.