For full details of how CFFormProtect works, see the project page at http://cfformprotect.riaforge.org/


Installation

  1. Copy the cfformprotect folder into your web root.
  2. On your form page, add this line of code: <cfset Cffp = CreateObject("component","cfformprotect.cffpVerify").init() />
  3. Put <cfinclude template="/cfformprotect/cffp.cfm"> somewhere between your form tags.
  4. On your processing page include the following code:
    <cfset Cffp = CreateObject("component","cfformprotect.cffpVerify").init() />
    <!--- now we can test the form submission --->
    <cfif Cffp.testSubmission(form)>
           <!--- The submission has passed the form test.  Place processing here --->
    <cfelse>
           <!--- The test failed.  Take appropriate failure action here. --->
    </cfif>
  5. Setup your email settings and Akismet in cffp.ini.cfm, if you want to use those features (if you leave the email settings blank, you won't receive an email when spammer tries to attack your forms)

Customization



INI File settings (cffp.ini.cfm)
Most of the values can be left as default, if you want, but you'll need to provide values for Akismet and Project Honey Pot if you want to use those tests. Thanks to Yves Prignon for creating this table for the INI settings.

Config Name

Default

Type

Accepted Values

Description

mouseMovement

1

boolean

    1, 0

Enable/disable the mouse test.

This test makes sure the user moved their mouse.

usedKeyboard

1

boolean

    1, 0

Enable/disable the keyboard test.

This test makes sure the user used their keyboard.

timedFormSubmission

1

boolean

    1, 0

Enable/disable the timed form test.

This test check how long the form entry and submission took.

hiddenFormField

1

boolean

    1, 0

Enable/disable hidden form field test.

This test makes sure a CSS hidden form field is empty.

akismet

0

boolean

    1, 0

Enable/disable the akismet test.

Uses the public Akismet service to test if form contents are spam. This is off by default, because you have to provide the details in the second section for Akistmet to work. Akistmet is not a free service and require the application to exchange data with the outside world.

LinkSleeve

1

boolean

    1, 0

Enable/disable the LinkSleeve test.

Uses the public LinkSleeve service to test if form contents are spam.

tooManyUrls

1

boolean

    1, 0

Enable/disable the tooManyUrls test.

This test will add up the number of URLs that are found in all of the submitted form fields, and mark the submission as spam if the total exceeds the limit configured by the tooManyUrlsMaxUrls variable in the ini file.

teststrings

1

boolean

    1, 0

Enable/disable the teststrings test

This test will compare the words in the form submission to a list of configurable "spammy" words, and mark the submission as spam if one of these words is found. The list can be edited by editing the spamstrings variable in the ini file.

projectHoneyPot

0

boolean

    1, 0

Enable/disable the Project Honey Pot test.

Project Honey Pot is a free web service that will check the IP address of your site's visitor. they maintain a huge database of known Spammer IP addresses, and when a user submits your form, this test will check their IP address. This is off by default, because you have to provide the API key in the second section.

Individual Test Config





timedFormMinSeconds

5

numeric

    whole number only

The minimum seconds allowed for a user to fill out the form.

timedFormMaxSeconds

3600

numeric

    whole number only

The maximum seconds allowed for a user to fill out the form.

encryptionKey

JacobMunsOn

string

    longest is better

Used in the timedForm test, to encrypt the time so it can be stored in a hidden form field (to help fool the spammers).

akismetAPIKey

[null]

string

    valid Akismet key

This is the api key that you received from Akismet.

akismetBlogURL

[null]

string

    valid URL

The URL for your site here, it's a required value for the Akismet service.

akismetFormNameField

[null]

string

    valid field name

The name of your "Name" form field.

akismetFormEmailField

[null]

string

    valid field name

The name of your "Email address" form field (optional).

akismetFormURLField

[null]

string

    valid field name

The name of your "URL" form field (optional).

akismetFormBodyField

[null]

string

    valid field name

The name of your "Comment" form field.

tooManyUrlsMaxUrls

6

numeric

    whole number only

The maximum amount of URLs that can be passed in the form contents.

spamstrings

free music, download music, music downloads, viagra, phentermine, viagra, tramadol, ultram, prescription soma, cheap soma, cialis, levitra, weight loss, buy cheap

string

    coma separated list

A list of strings that form contents will be compared to.

projectHoneyPotAPIKey

[null]

string

    valid Project Honey Pot key

This is the api key that you received from Project Honey Pot at http://www.projecthoneypot.org/.

Failure Limit





mouseMovementPoints

1

numeric

    whole number only

Points given for the mouse movement test.

usedKeyboardPoints

1

numeric

    whole number only

Points given for the used keyboard test.

timedFormPoints

2

numeric

    whole number only

Points given for the timed form test.

hiddenFieldPoints

3

numeric

    whole number only

Points given for the hidden field test.

akismetPoints

3

numeric

    whole number only

Points given for the Akismet test (if used).

linkSleevePoints

3

numeric

    whole number only

Points given for the LinkSleeve test.

tooManyUrlsPoints

3

numeric

    whole number only

Points given for the URL count test.

spamStringPoints

2

numeric

    whole number only

Points given for the spam string test.

projectHoneyPotPoints

3

numeric

    whole number only

Points given for the Project Honey Pot test (if used).

failureLimit

3

numeric

    whole number only

The total amount of points you will allow before flagging a message as spam. Each test that fails will assign "failure points" to the form submission. If the total point exceeds the failureLimit, the message will not be sent.

Email Settings





emailFailedTests

0

boolean

    1, 0

Enable/disable emailFailedTests to receive email reports in case of spam detection.

emailServer

[null]

string

    valid address

Email sever address.

emailUserName

[null]

string

    valid username

Email account user name.

emailPassword

[null]

string

    valid password

Email account password.

emailFromAddress

[null]

string

    valid email address

Email address used for the "from" field.

emailToAddress

[null]

string

    valid email address

Email address used for the "to" field.

emailSubject

[null]

string

    valid email subject

Email subject.

Logging





logFailedTests

1

boolean

    1, 0

Enable/disable logging of spam submissions.

logFile

[null]

string

    Valid file name

To specify a different log file name.

 

CFFormProtect is governed by the mozilla public license version 1.1.
See the included License.txt or http://www.mozilla.org/MPL/ for details