InMotion Hosting Support Center

Default contact form osCommerceWhen you install osCommerce, you will have a Contact form by default set up for your shop. The Contact form provided works well, except, there is no validation preventing robots from filling the form out. This article will explain how to secure your website contact form using the Simple Captcha Add-On.

Download the captcha module

Download captcha plugin osCommerceBefore you can set up the captcha on your contact form, you will need to download the files from the osCommerce Add-On site. Visit the link below and download the file with the Add-On code.

Once you get the file on your computer, follow the steps below.

Steps to add a captcha to your contact form

  1. Copy captcha files osCommerceUpload the files in the catalog folder to your osCommerce installation directory.
  2. Copy image to the server osCommerceUpload the example-bh63v.jpg image file to your images directory in your osCommerce installation folder.
  3. Rename the image osCommerceRename the image to captcha.jpg.
  4. create a new folder osCommerceCreate a folder in your osCommerce installation folder and call it "fonts".
  5. Upload the font osCommerceUpload your font to the font directory for the captcha to work. In this tutorial we are using the Aerovias Brasil font available here.
  6. Edit the validation file osCommerceEdit the following file.

  7. Add the captcha code to the file osCommercePaste the following code into the validations.php file before the ?> at the bottom of the page.
    define('CAPTCHA_FONT', DIR_FS_CATALOG . 'fonts/truetypefont.ttf');
    define('CAPTCHA_LOAD', 'images/captcha.jpg');

    Note! You will need a font uploaded. Make sure you change the truetypefont.ttf file name to your font file name. In this case the path will be AeroviasBrasil.ttf.

    Save the changes.

    Final view of captcha osCommerceNow visit your website where the contact form is and you will see the captcha on the page.

Was this article helpful?
Continued Education in Course 203: Adding security to osCommerce
You are viewing Section 3: Securing your osCommerce contact form with the Simple Captcha Add-On
Section 2: How to Secure Your osCommerce Site with the htaccess/htpasswd

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

n/a Points
2015-10-24 4:49 am

I have done the installation steps and it doesn't work unfortunately.  The captcha.jpg is being created and refreshed at ./image/ directory.

Even I have input the correct phase, it is always returning the message as below.

" Sorry, you have provided an invalid code. "

Where can I find out the root cause?  Thanks in advance.

43,761 Points
2015-10-26 9:07 am
Hello Willie,

You may want to check the module page to ensure it has been kept up to date. Also, check to see if there is a support forum for the module that the developer uses to answer questions and issues.

Kindest Regards,
Scott M
n/a Points
2015-04-03 3:35 am

i used your captcha in oscommerce but ho to refresh captcha image without reload page , please provide us the image .php file and any suggest to do that . i am talking about the captcha which one your mention above . please  please please please please please!

42,946 Points
2015-04-03 10:37 am
Hello Raj,

We unfortunately can provide a direct solution for that, as it requires changing the code to accomplish the refreh. Check out refresh captcha. This may provide the code that you need.

I hope this helps to answer your question, please let us know if you require any further assistance.

Arnel C.
n/a Points
2014-11-19 10:22 am

I am getting this error:


Warning: require(includes/template_top.php) [function.require]: failed to open stream: No such file or directory in /home/pt000071/public_html/store/catalog/contact_us.php on line 76 Warning: require(includes/template_top.php) [function.require]: failed to open stream: No such file or directory in /home/pt000071/public_html/store/catalog/contact_us.php on line 76 Fatal error: require() [function.require]: Failed opening required 'includes/template_top.php' (include_path='.:/opt/php5/lib/php') in /home/pt000071/public_html/store/catalog/contact_us.php on line 76



new to oscommerce


Any ideas?

42,946 Points
2014-11-19 11:06 am
Hello Justina,

Sorry you're having problems with osCommerce. The error indicates that the referenced file "template_top.php" doesn't exist. This may be a part of your installation that is damaged, or the reference to the file may need to be corrected. However, the problem is that we need more info on how the error started. Where you installing something? Can you describe the steps you take to generate this error (if steps are required)? Where does this error occur? It would help to have a URL. What version of osCommerce are you using?

We basically need more information in order to provide assistance with this issue. Please provide this information and we would be happy to help.

Arnel C.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

6 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!