All server job described in this quote:
It calls captcha.php file and gets a
random number. Php file just generates
simple number and put it in session.
When AJAX got that number it creates
items based on that number.
So here's a quick and not really tested port of their PHP example in CFML:
<cflock scope="session" type="exclusive" timeout="5">
<cfif StructKeyExists(form, "captcha") AND StructKeyExists(session, "captcha") AND form.captcha EQ session.captcha>
<!--- YOUR CODE GOES HERE --->
Passed!
<!--- this line makes session free, we recommend you to keep it --->
<cfset StructDelete(session, "captcha") />
<cfelseif StructKeyExists(form, "captcha")>
Failed!
<cfelse>
<!--- in case that form isn't submitted this file will create a random number and save it in session --->
<cfset session.captcha = RandRange(0,4) />
<cfoutput>#session.captcha#</cfoutput>
</cfif>
</cflock>
Please note that geenrated range from 0 to 4 is not really good, because of its small size (repeats often). But maybe it is just enough for this case.