Adding CAPTCHA to your forms prevent SPAM.

{DirectPHP ignore}

1. What is CAPTCHA?

Captcha is an acronym which stands for:

Turing test to tell
Computers and

This is a fancy way to explain a simple verification system made up of an image, form, and php code to validate a Human is actually completing the contents of a form. Captcha can be a great help in downsizing or diminishing form spamming. When a human user enters a captcha page and sees a code generated image - usually numbers and letters - he/she must insert this code, by typing the same numbers or letters in the image into a field and if he has copied correctly - he/she will be allowed to click the send button and either send the form or proceed to other web pages. An Internet 'Bot on the other hand, does not have such sophistication, and mostly is programmed to extract e-mail addresses from the html code of a web page.


2. How do I implement CAPTCHA with my forms?

Calweb has provided a CAPTCHA tool for you to easily add to your forms. Simply add the CAPTCHA code to your form where you want the CAPTCHA image to appear. Then redirect your SUBMIT button to the CAPTCHA verification routine before passing the form data to your mailer or web application.

An example of a CAPTCHA Form can be found here. Try it!

PHP Code to generate a CAPTCHA Image:  (Specific code highlighted in red)

if (empty($_POST)) { ?>
<form method="POST">
<!-- pass a session id to the query string of the script to prevent ie caching -->
<img src="<?php echo md5(uniqid(time())); ?>"><br /><br/>
<input type="text" name="code" /><br />

<input type="submit" value="Submit Form" />
} else { //form is posted
$img = new Securimage();
$valid = $img->check($_POST['code']);

if($valid == true) {
echo "<center>Thanks, you entered the correct code.</center>";
} else {
echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>";

If you need further help implementing CAPTCHA for your forms contact your web designer or This email address is being protected from spambots. You need JavaScript enabled to view it..

NOTE: This information is for CalWeb Internet Service's customers only and for websites that are hosted on our servers. The information provided is also as-is and with no warranty. We do not offer support/help to implement this except as a billable consulting service at our standard $75 per hour rate.  Non-CalWeb websites using will be subject to being blocked and breaking your form, so please do not use it. Thank you.