Print Page | Close Window

CAPTCHA correct check not working

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz CAPTCHA
Forum Description: Support forum for the Web Wiz CAPTCHA security image.
URL: https://forums.webwiz.net/forum_posts.asp?TID=21041
Printed Date: 28 March 2026 at 2:25am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: CAPTCHA correct check not working
Posted By: jdinger
Subject: CAPTCHA correct check not working
Date Posted: 15 August 2006 at 4:55pm
Hello,

I'm trying to set up CAPTCHA.  The image shows but I can't make it check that the correct code is entered.  It lets me submit the form whether I enter a code or enter it incorrectly.

I've tried putting the "If blnCAPTCHAcodeCorrect..."code in my form processing file everywhere I can think of.

Here's the code for my form handler:

<%

<!-- include the Web Wiz CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->

email = Request.Form("eaddress")
message = Request.Form("message")
name = Request.Form("name")
subject = Request.Form("subject")
thisDate = FormatDateTime(Date,1)
thisTime = FormatDateTime(Time,4)


ReferringPage = Request.Form("referpage")


If email = "" or message = "" or subject = "" Then
    Response.Write("<center><br><h3>All required fields must be filled before your message can be delivered.  <br><br> Use your browser back button to return to the form.</h3>")


Else
Set fs = CreateObject("Scripting.FileSystemObject")
Set msg = fs.CreateTextFile("g:\InetPub\mailroot\pickup\message.eml", True)
msg.WriteLine("x-DateTime:" & Now)
msg.WriteLine("From: " & email)
msg.WriteLine("To: xxxx@xxxx")
msg.WriteLine("Cc: " & email)
msg.WriteLine("Subject: " & Subject)
msg.WriteLine(thisDate & thisTime)
msg.WriteBlankLines(1)
msg.WriteLine("This is a copy of the message you submitted to the Minnesota Legislative Web Site.")
msg.WriteLine("Staff from the Minnesota Legislative Reference Library will contact you shortly.")
msg.WriteBlankLines(1)
msg.WriteLine("Referring Page = " & ReferringPage)
msg.WriteBlankLines(1)
msg.WriteLine(Request.Form("message") )
msg.WriteBlankLines(1)
msg.WriteLine("    " & Request.Form("name") )

msg.Close

Response.Redirect "http://www.leg.mn/leg/thanksmail.asp"

End If

%>

If anyone could help me figure out where to put the "If blnCAPTCHA..." code I would greatly appreciate it!


-------------
Julie Dinger
Web Services Librarian
Minnesota Legislative Library



Replies:
Posted By: WebWiz-Bruce
Date Posted: 15 August 2006 at 5:37pm
The lines:-

<!-- include the Web Wiz CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->

Need to be before the ASP tag: eg:

<!-- include the Web Wiz CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
<%

If blnCAPTCHAcodeCorrect = false Then
        Response.Write("incorrect")
        Response.End
End If


%>


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: jdinger
Date Posted: 16 August 2006 at 4:25pm
Thank you for the suggestion.   I moved the lines you referenced outside the asp tags, and it's still not working.

Here is the code I'm inserting:

If blnCAPTCHAcodeCorrect = True Then
            Response.Write(" CAPTCHA code is correct")
        ElseIf  blnCAPTCHAcodeCorrect = False Then
            Response.Write(" CAPTCHA code is NOT correct")
        End If

Maybe there is something wrong with that, or something wrong in my file.

Thank you very much for your assistance.


-------------
Julie Dinger
Web Services Librarian
Minnesota Legislative Library


Posted By: WebWiz-Bruce
Date Posted: 17 August 2006 at 9:11am
Looks like your getting a bit confused, you don't move the ASP code outside the ASP blocks, just the link to the include file.

Lets start again.

1. Make sure the file you are incerting this in has an .asp extension.

2. At the top of the page outside the ASP block place in:-


<!-- include the Web Wiz CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->



3. Underneath this in an ASP block place the follwoing:-


<%
If blnCAPTCHAcodeCorrect = True Then
            Response.Write(" CAPTCHA code is correct")
ElseIf  blnCAPTCHAcodeCorrect = False Then
            Response.Write(" CAPTCHA code is NOT correct")
End If
%>





-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: jdinger
Date Posted: 17 August 2006 at 2:46pm
That is what I did--links to include file outside asp tags, captcha code inside asp block. 

What happens is when I put the include file outside the tags, it breaks my thank you page (I get a "page cannot be displayed" page).

Interestingly, when I try the code with the include instructions INSIDE the asp block, I get a "CAPTCHA code is NOT correct" reply no matter whether I enter the code correctly or not instead of getting an error message. But I believe you that the include instructions should be outside the asp block. It's weird tho' that it works at least halfway with them inside the asp tags.

I think it must be something within my asp file or the way my form handler is set up, the thank you page that's being called, etc.  I don't know.

It's a great program, thank you for it and for your help.  I'll keep messing with it and hopefully can figure out how to make it work. We're drowning in spam at our reference desk through our comments form.


-------------
Julie Dinger
Web Services Librarian
Minnesota Legislative Library


Posted By: WebWiz-Bruce
Date Posted: 17 August 2006 at 3:51pm
The page display error will be a 500 internal server error, if you disable friendly HTTP errors in IE you will get an accurate error message which will tell us what is wrong

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net