• Adding Captcha Protection to a Form •
Description:
Are your forms being abused by
spam robots? Are you're tired of deleting hundreds of
junk form submission emails in order to find one from
a real customer? Then you need to add a 'captcha' to your
forms to protect them from spam and other abuse.
"CAPTCHA" is an acronym
for "Completely Automated Public Turing test to tell
Computers and Humans Apart." It consists of a series
of random images of letters or numbers in an image that
must be entered correctly with the form submission to
verify that a real person is submitting the form - not
a spam bot.
Wolfpaw has added an easy-to-use FormtoMail
with CAPTCHA CGI program to its Unix servers that any
of our hosted websites can use. Just follow the instructions
for our standard FormtoMail CGI with the following changes.
Form Action Command:
Use formtomail2.pl instead
of formtomail.pl in your FORM ACTION command
as follows:
<FORM METHOD="POST" ACTION="/cgi-bin/formtomail2.pl"
ENCTYPE="x-www-form-encoded">
Display the CAPTCHA image:
After you've
added all the elements for your form you need to create
a place holder where the program can insert an image of
a series of random numbers. Just add the following line
to your html code:
<img src="/cgi-bin/captcha.pl"
height=21 width=76>
Add the CAPTCHA input field:
Here's where the real person will enter
the numbers he sees. Add this line to your form. Make
sure the element has the name captcha:
If the user enters the correct number the
form program will work as usual - the form results will
be emailed to you. However, if the wrong number is entered
the user will get a screen telling him that the number
entered was incorrect and to try again.
The finished product:
Here's what your CAPTCHA should look like:
Note: If, after clicking
on submit you hit the back button on your browser
you'll need to refresh your browser in order to
get a new CAPTCHA code. The old code cannot be used again.
|