I’ve been using the “timestamp trick” to reduce form submission spam for the past few months now. It’s been extremely effective!
Today was the first time I had to employ it on a ColdFusion-based site. The basic principle is the same, but it isn’t readily apparent how to obtain the timestamp.
The following code illustrates it’s use:
Put this on your form page:
<input name="ts" type="hidden" value="#DateDiff("s", CreateDate(1970,1,1), NOW())#">
Put this at the top of your processing page:
<cfset currentTime = DateDiff("s", CreateDate(1970,1,1), NOW())> <cfif currentTime - form.ts lt 3> <cflocation url="/"> <cfabort> </cfif>
Now, any bot that attempts to submit the form in less than 3 seconds will be automatically redirected to your home page, instead of continuing with the processing script.