<!--- Get the key that we are going to use to encrypt the time stamp. Rand() gives us a multidigit number between zero and one. ---> <cfset REQUEST.SpamKey = ToString( Rand() ) /> <!--- Once we get this number, we are going to strip out the leading zero/one and decimal place. This should leave us with a digit-only string of characters. ---> <cfset REQUEST.SpamKey = REQUEST.SpamKey.ReplaceFirst( "(\d*\.)?0*", "" ) /> <!--- Get the time span for which this form is active. CreateTimeSpan() gives us a float value to represent the 7 minutes during which time this form can be submitted. ---> <cfset REQUEST.ActiveTimeSpan = CreateTimeSpan( 0, 0, 7, <!--- 7 Minutes. ---> 0 ) /> <!--- Get the time spam for which this form MUST be active. This form is not allowed to be submitted before it has been live for 10 seconds. CreateTimeSpan() gives us a float value representation of the time span. ---> <cfset REQUEST.RequiredActiveTimeSpan = CreateTimeSpan( 0, 0, 0, 10 <!--- 10 Seconds. ---> ) /> <!--- Get the cut off date for this active form. To get this value, we will add the time span above (7 minutes) to the current time. NOTE: Since the time span created above is a float value, this addition will AUTOMATICALLY convert the result to a float rather than a string-style date. ---> <cfset REQUEST.CutOffDate = ( REQUEST.Environment.DateTime.Now + REQUEST.ActiveTimeSpan ) /> <!--- Get the early cut off date for this active form (this is the time the form is required to exist). Like the above date, the results of this will be a float value, not a standard string-style date. ---> <cfset REQUEST.RequiredCutOffDate = ( REQUEST.Environment.DateTime.Now + REQUEST.RequiredActiveTimeSpan ) /> <!--- Encrpt the cut off date using our randomly generated spam key above. Using the CFMX_COMPAT algorithm, we are going to convert this to a HEX value. ---> <cfset REQUEST.CutOffDateEncrypted = Encrypt( REQUEST.CutOffDate, REQUEST.SpamKey, "CFMX_COMPAT", "HEX" ) /> <!--- Encrpt the required cut off date using our randomly generated spam key above. Again, we are creating a HEX value for this encryption. ---> <cfset REQUEST.RequiredCutOffDateEncrypted = Encrypt( REQUEST.RequiredCutOffDate, REQUEST.SpamKey, "CFMX_COMPAT", "HEX" ) /> <!--- Encrupt the spam key that we generated above. Seeing as our spam key is totally random, once we encrypt it with our global encryption key (nutz_4_butts), I don't see how it can be cracked. ---> <cfset REQUEST.SpamKeyEncrypted = Encrypt( REQUEST.SpamKey, "nutz_4_butts", "CFMX_COMPAT", "HEX" ) />