I have selfmade spambot checker in my forum but it doens't work. Span advettises still coming through. I have in formpage simple question where i ask sum of the two number. User have to write sum of those numbers in input box and in action page that answer compare with right answer. Those numbers are random and those are different ewery time. What is wrong in my code logic?
Here is my form page number section:
<cfset numero1 = "#randrange(1,10)#" />
<cfset numero2 = "#randrange(1,10)#" />
<CFSET yhteensa=numero1 + numero2>
<cfoutput>how much are these two numbers: #numero1# + #numero2# ?</cfoutput><br>
<br>
write your answer and press ok: <br>
<input name="luku" type="text" size="10"><br>
<cfoutput>
<INPUT TYPE = "hidden" NAME="summa" Value = "#yhteensa#">
</cfoutput>
and here is the ACTION PAGE::
<cfif(#form.luku# IS #form.summa#)>
<cfparam name="Reply" default="N">
<cfquery name="thread_query" datasource="#datasource#">
SELECT MAX(Thread) AS n FROM ForumThreads
</cfquery>
<cfif thread_query.n gt 0>
<cfset Thread = thread_query.n+1>
<cfelse>
<cfset Thread = 1>
</cfif>
<cfquery name="check_forum" datasource="#datasource#">
SELECT AllowHTML FROM ForumList
WHERE ForumID = #ForumID#
</cfquery>
<CFSET form.Body = replace(form.Body,"#Chr(13
)##Chr(10)
#", "<br>", "ALL")>
<cfquery name="post_topic" datasource="#datasource#">
INSERT INTO ForumThreads
(DateIn,ForumID,Thread, Author,LastPost,Subject,Re
ply,Body)
VALUES (#CreateODBCDateTime("#Now
()#")#,#Fo
rumID#,#Th
read#,'#fo
rm.Author#
', #CreateODBCDateTime("#Now(
)#")#,'#fo
rm.Subject
#','#Reply
#','#form.
Body#')
</cfquery>
<cfquery name="update_forum_1" datasource="#datasource#">
SELECT ThreadID FROM ForumThreads
WHERE ForumID = #ForumID# AND Parent = 0
</cfquery>
<cfquery name="update_forum_2" datasource="#datasource#">
SELECT ThreadID FROM ForumThreads
WHERE ForumID = #ForumID#
</cfquery>
<cfquery name="update_forum_3" datasource="#datasource#">
UPDATE ForumList
Set NumOfTopics=#update_forum_
1.RecordCo
unt#,
NumOfPosts=#update_forum_2
.RecordCou
nt#,
LastPost=#CreateODBCDateTi
me("#Now()
#")#
WHERE ForumID = #ForumID#
</cfquery>
<cflocation url="katso_aihe.cfm?ForumI
D=#ForumID
#" addtoken="No">
<CFELSE>
<!-- if not equal then do this -->
<script>
alert("Wrong answer");
self.location="index.cfm";
</script>
</cfif>
Start Free Trial