Adding A Honey Pot To Block Form Spamers
A honey pot is a trap that most of the form spam-bots will fall into because they just can't resist. It is made up of 3 parts. First is a css definition that will make the display invisable on the page. The second is a form field that must be left blank or the form does not process. The third part is some conditional processing that will not send an email if the hidden field is filled in. Since all form spam-bots are blind (i.e. they only read the raw html code and can not see what is viable to the web site visitor), when they see a form input box named URL or EMAIL they just have to stick their spam links in there. Once they do that, they show that the form was filled in by a bot and not by a real person because the URL field is invisible to a real person. Once we know the form was filled in by a bot, we can do some conditional processing and only send an email if it was filled in by real people.
To use this spam block you would create a form using Fusion's standard Form Tools. A simple form would consist of a name field (visitName) an email field (visitAd) and a comments field (comments). It is always a good idea to avoid using a name such as email or email-address as bots look for anything with email or url in it. In this example I have used visitAd (for visitor's address)
Before you begin you need to have a fully functioning form. You need to know before you start that your form works so that if there are any problems they will be with the honey pot and not something to do with your normal form processing. The insertion of the input field which uses the hidden css code we will create assumes that you have your form completed and tested (i.e. insert the honey pot into a known working form so that if you have problems you will know that the form worked BEFORE you made these changes to it).
Step 1 Create A Hidden CSS Definition
First we will need to create a CSS class to hold our hidden definition
On the page that contains your form from the menu bar click Text, then from the drop down, select Manage Styles
- Click the New button in the lower left corner of the Manage Styles properties palette
- In the Style Type area click the Radio Button Create Custom Style
- Name the style hideField (one word with a capital F in the middle)
- In the Style Scope area select Page Specific
When you click OK the Text Format properties palette will open up
- Click the Custom Tab
- Click the New button
- In the Attributes Properties for Name enter display
- For Value enter none
- Click OK
Step 2 Insert the Invisible URL Input Field
- On your form, click on the email address input box to bring up the Form Edit Field properties palette
- Click on the HTML button
- On the first line of the Object HTML insertion dialog box paste this block of code
<div class="hideField"><input type="text" name="url" value=""></div>
Remember how we said form-bots can't resist a URL input field?
Now that we have caught our form spam-bot we need to tell the processing page to throw away any forms that are submitted that have any content entered in the URL field. Only a form spam-bot will see the URL field and since they only want to spread links to other spam sites they will always make an entry into any field that says URL
Step 3 Do Conditional Processing To Stop Bots
- Go to your forms processing page
- Press F9 to bring up the Layout Properties palette
- Press the HTML button
- On the first line enter your conditional processing to skip sending the email if there is anything in the URL field
In ColdFusion this would be
<cfif #form.url# EQ "">
cfmail coding goes in between the cfif and /cfif statements
The Thank You html page will display for everyone so even the form spam-bot will think that they have been successful with their attempt to send you a link that tells you how you can enlarger your...... Only the input from a live web site visitors (who cannot see the URL field and leave it blank) will have their form processed and an email sent
Did you find this tutorial useful?
Do you want to keep this resource online?
Make a donation to keep gotFusion alive
This page was written by and is maintained by turtle