Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - CAPTCHA correct check not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedCAPTCHA correct check not working

 Post Reply Post Reply
Author
jdinger View Drop Down
Newbie
Newbie


Joined: 15 August 2006
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdinger Quote  Post ReplyReply Direct Link To This Post Topic: CAPTCHA correct check not working
    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!
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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


%>


Edited by -boRg- - 15 August 2006 at 5:39pm
Back to Top
jdinger View Drop Down
Newbie
Newbie


Joined: 15 August 2006
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdinger Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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
%>



Back to Top
jdinger View Drop Down
Newbie
Newbie


Joined: 15 August 2006
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdinger Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.