Captcha for web Forms

Spam is now attacking Web forms and using captcha code is one way to try and combat that problem. Captcha is a randomly generated code that needs to be entered into a form field prior to the form being submitted. This ensures that the form is being completed by a human and not some spambot. Here are the steps and code that should be placed within the form.

  1. Download the Captcha.zip file.
  2. Extract the files from the zip file and put the captcha.swf, captch.asp, and swfobject.js in the same folder as your form.
  3. The page your form is on needs to be changed from a .htm or .html to a .asp page. For example if your page is currently form.html it needs to be renamed to form.asp or this will not work correctly.
  4. Add this line to the top of the page the form is on:
    <!--#include file="captcha.asp"-->
  5. Inside the head of that page add this line:
    <script type="text/javascript" src="swfobject.js"></script>
  6. Add this code to where you want the flash object to appear in your form:
    <div id="flash-captcha"></div>
    It is recommended that this be near the the form field that is entered in #8.
  7. Right above the closing body tag, add this code:
    <script type="text/javascript">
    var so = new SWFObject('captcha.swf', 'fc','100','40','7');
    so.addVariable('code','<%=code%>');
    so.addVariable('autostart','true');
    so.write('flash-captcha');
    </script>
  8. In the form place the following form field that requests that the code be entered.
    <label for="security_code">Security Code: </label><input id="security_code" name="security_code" type="text" />