Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - CAPTCHA Code Still Not Working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedCAPTCHA Code Still Not Working

 Post Reply Post Reply Page  <123
Author
Davecl View Drop Down
Newbie
Newbie
Avatar

Joined: 22 November 2006
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Davecl Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 6:35am
Originally posted by lowgenius lowgenius wrote:

I just did it the other way around, and that seems to work too ;-)


If you'd like, I can post an abridge code sample, but I suspect that you're understanding what i've done without that.
 
 
yes, I've got i t now LOL and obviuosly you are right, if (like my example) you remove the include from the processing file and then the form is not submitted to that page, then the variables have not been declared, however doing it your way and removing it from the captcha code itself, they are declared cos the processing file declares 'em.
 
So there we have it .. it works either way Big%20smile
Thanks for pointing that out lowgenius, i am confident it will help someone.
Back to Top
Davecl View Drop Down
Newbie
Newbie
Avatar

Joined: 22 November 2006
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Davecl Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 6:38am
Originally posted by bobmac bobmac wrote:

Thanks lowgenius...

You say "If you'd like, I can post an abridge code sample, but I suspect that you're understanding what i've done without that."

I'd like to take you up on that.  Big%20smile  I started this thread because I was totally stopped by the name redefine thing. It sounds like you understand this stuff--which I don't Confused--so I any ideas. Davecl was helpful in a PM, but If I see this thing from several angles, there's a slight chance that I might get it!  LOL
 
still no luck bob? you never got back to me so i presumed you'd sorted it, maybe lowgenius can help.
Back to Top
bobmac View Drop Down
Newbie
Newbie


Joined: 18 November 2006
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote bobmac Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 7:08am
Originally posted by Davecl Davecl wrote:

still no luck bob? you never got back to me so i presumed you'd sorted it, maybe lowgenius can help.


I'm still a bit stuck and VERY short on time. I'm hoping to get some stuff done during the holidays. Did I say holidays???? I thought that meant time off!!! LOL

But I will definitely get back to both you and this great forum on my results!

Thanks to all...and happy holidays, no matter which one you are celebrating...Clap
Back to Top
lowgenius View Drop Down
Newbie
Newbie


Joined: 02 August 2004
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote lowgenius Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 11:16am
Sorry about the lag, I'm over here in the colonies, so I just woke up...

As requested, instructions/code for a single-page e-mail form using WWG CATPCHA.  I'm assuming that you have everything installed where it needs to be.

Step 1:  Remove the line <!-- #include file="CAPTCHA_setup.asp" --> from the CAPTCHA_form_inc.asp file

Step 2:  Construct your mail form page as follows (comments are in blue):

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!-- not sure if this works with ASP/JS or not -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
<!-- doctype, xmlns, head meta tags, whatever here -->

<body>
<!-- page contents, however you have it set up.  Note that the block of code below should appear INSIDE whatever container you want your confirmation message to appear in; this ensures that the message displays in context, rather than at the top of the page before your masthead, menus, etc. as it would if you put the processing code before the html tag -->
                         
<%
If Len(Request.Form("sender")) > 0 then

'checks to see if there's any information in the sender field of the form; this serves as both rudimentary prevention of blank forms and as a yes/no check on whether a form has been submitted; you'll see why that second part is important in a minute


    If blnCAPTCHAcodeCorrect = True Then 'If they get the code right
    'send the message
        'CDONTS code snipped

        Response.write("<h3><i><font color='ffffff'>Your message has been sent to LowGenius Web Design.  We will be in contact with you as soon as possible.  Thank you!</font></h3></i>")
    ElseIf blnCAPTCHAcodeCorrect = False Then ' if they get the code wrong, tell them so
        Response.Write ("<h3><i><font color='ffffff'>You have entered an incorrect code for the CAPTCHA humanity test.  This code help reduce abuse of our contact form by automated systems.  Please use the 'Back' button on your browser to try again.</font></h3></i>")
    End If    'note that this ends the NESTED If; we're still inside another If...Then...Else loop
Else 'If there is no information in the Sender field, assume that the form has not been populated, and display the form
%>

<!-- Insert your form here, and at some point include this, INSIDE THE FORM TAG: -->
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
<!-- Continued form code until form and other content you want displayed if there is NO FORM SUBMITTED is ended -->
<% End IF ' and now we break out of the larger if-then-else statement %>
<!--- and the rest of your page code goes here, to be displayed regardless of the form state (submitted or not) -->

The idea here is this: If you load the variables from the setup include at the top of the page, then they're active regardless of whether a form has been submitted or not.  If a form has NOT been submitted, then those variables just remain empty but have been declared so you don't run into problems when the captcha include file tries to define them.  If a form HAS been submitted, then the variables are declared and then populated with your processing code.  It's probably not great practice to have declared variables laying around undefined; if you're a real stickler for detail you can set them to 'nothing' in a code block after the end of your form but BEFORE your final End If; otherwise you'll clear them when the form is submitted and you will end up constantly 'failing' the captcha test.

Please feel free to yank (no pun intended) my chain if you need more clarification; brevity is not my strong suit.


Edited by lowgenius - 20 December 2006 at 11:20am
Back to Top
 Post Reply Post Reply Page  <123

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.