Captcha CGI Email Forms



What is a Captcha?
Installation:
To install a Captcha form you must have knowledge of forms and your directory structure as well as SSH access to your account.  To get SSH access let us know.  If you think you can not install the form, then please contact our customer support to schedule an installation.  We can install the Captcha form for you for a very small fee.

Instructions: 
Enter your account through SSH. 
Once there goto your web directory (usually public_html)
Create a new directory called cap and go there

Download the files:
Download the Captcha files to your account using the following command:
wget http://paraseek.com/cap/cap.tar
(The original raw files can be downloaded from here is needed: http://bumblebeeware.com/formmail/)

Expand the file ball:
The file you just got was compressed and contains a hundred or so files.
You must compress this file ball with the following command:
tar -xvf cap.tar

Configure the script:
Ok you should have seen a lots of files load into the cap directory.  You now
need to set a few variables not in the file called capform.cgi.
1) Replace the email address shown with your email address. Note that this must
use a domain name that is on the server.
$tomail = 'admin@mydomain.com';
2) Define the redirect page that people will be taken to when form submission is successful.
$sendtopage = "http://mydomain.com/thankyou.html";
3) Set the maximum number of failure to allow per day before a user is locked out for 24 hours.
$maxtries = 4;

Check Permissions:
Make sure all cgi and pl files that were installed are the correct permissions.
They should be permissions 755. The TEMP directory should be 777. And all
directories and files should be owned by your username.

Now test your form:
A sample form is already installed for your use called form.html.  For instance,
if your domain name is rabbit.com, then the form would be at
http://rabbit.com/cap/form.html
Give the form a test and see if it is working.  Now alter the form fields however
you may want.

Modifications:
This form was written by the good people at bumblebeeware.com.  Please visit their
site for mods to this script as well as access to the raw data files.
Changing Reply-to Setting

By default the captcha script will put the to and from fields from
the same party (you).  You can change this so that the sender's
email address is in the reply-to.

Look for the following code in capform.cgi
      open( MAIL, "|$mailprog -t" );
      print MAIL "Subject: Your subject line is here\n";
      print MAIL "From: $tomail\n";
      print MAIL "To: $tomail\n";
      print MAIL "Reply-to: $tomail\n\n";
now change this code to this:
     $mailfrom = $form{'email'};
     open( MAIL, "|$mailprog -t" );
      print MAIL "Subject: Pot Racks Online Inquiry\n";
      print MAIL "From: $mailfrom\n";
      print MAIL "To: $tomail\n";
      print MAIL "Reply-to: $mailfrom\n\n";

Sorting fields
By default the captcha script will sort your fields
randomly. However, you can hack the script to sort alphabetically
by altering these lines in capform.cgi:

Look for the following:
Print all the variables on the form
sub all_fields {
foreach $key (keys %form) {
alter the last line to read
foreach $key (sort keys %form) {

The system will not sort alphabetically. To sort them in any order
you want, now name your fields starting with 1., 2., etc.

More form techniques
The above example shows you how to create forms with simple text fields.  However you can also insert fancy fields for the user to enter data including comment boxes, radio buttons, pulldown menu's, etc.  To review these, check out this resource which gives you a tutorial on all of the html tags available inside of a form.