IVERIFII.com - Everything IT
- by Mac Evangelist


Read iVerifii.com via Email

Your email address:

Powered by FeedBurner



The steps to Implement reCAPTCHA to osCommerce ( v2.2 ).

written by IT Evangelist

A CAPTCHA is program that can tell whether its user is a real human or a computer while reCAPTCHA is a  free CAPTCHA service.

By implement the reCAPTCHA within a website, you will be able to  prevents the spam problem, especially for the fake registration. Now going to share the steps about implementing the reRECAPTCHA for osCommerce v2.2.

Following is the steps to implement the reRECAPTCHA,

Step 1 : Register and get your free reCAPTCHA at reCAPTCHA.net.

Step 2 : Add a New Site at reCAPTCHA and obtain the Public Key and Private Key.

Step 3 : Download the latest reCAPTCHA library at reCATPCHA’s library.

Step 4 : Go to your osCommerce installed folder, assumed that you’ve installed  osCommerce at the folder ./catalog , upload the recaptchalib.php from the Download library to this folder.

Step 5 : Looking for create_account.php and edit by the cPanel editor ( or you may download it by FTP and upload after you edited ).

Step 6 : Now we got to start the File Editing at osCommerce,

A ) Add the reCAPTCHA field at your desire location, at this example, we’ll position it right after the “Confirm Password Field” and before the “Submit” or “Continue” buttong. Looking for the following around Line 565,


<td><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>

<td><?php echo tep_draw_password_field(‘confirmation’) . ‘&nbsp;’ . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? ‘<span>’ . ENTRY_PASSWORD_CONFIRMATION_TEXT . ‘</span>’: ”); ?></td>


B ) Adding the Code for validate the reCAPTCHA

Looking for following around Line 157,

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

$messageStack->add(‘create_account’, ENTRY_TELEPHONE_NUMBER_ERROR);


Add the following, (remember to replace the “YOUR PRIVATE KEY” with the Private Key you got for your site)


require_once('recaptchalib.php'); $privatekey = "YOUR PRIVATE KEY "; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $error = true; $messageStack->add('create_account', $resp->error);


Step 7 : Proceed to this step only if you’re using the SSL. Open the library file recaptchalib.php

Looking for the following code around Line 106,  change the $use_ssl value from “false” to “true” as the following.

function recaptcha_get_html ($pubkey, $error = null, $use_ssl = true)

Now your osCommerce’s registration form is installed with the reCAPTCHA and you may proceed to test your site now. Further reference, please refer to reCAPTCHA

Leave a Comment - Here's your chance to speak.(eMail will not be published)

Look for It


Ads by Google