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
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 22 November 2006 at 3:01pm
You actually can get it to work on a form that submits to itself, to use multiple forms in different directories with one captcha, to use more than one form on a page, and to use it with a .net postback. But the advanced usage isn't supported by Borg.
 
Too many path and/or javascript and mods need to be done by the user to make them work. Became a support horror show so I believe Borg opted to KISS.

Lead me not into temptation... I know the short cut, follow me.
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: 22 November 2006 at 3:02pm
done it Smile
here goes
 
first in CAPTCHA_process_form.asp find this code (top of file)

<!-- #include file="CAPTCHA_setup.asp" -->
<%
'****************************************************************************************
'**  Copyright Notice
'**
'**  Web Wiz Guide - Web Wiz CAPTCHA
'** 
'**  http://www.webwizCAPTCHA.com
'**
 
and remove the line in red, this is to prevent the variable blnCAPTCHAcodeCorrect being dimmed twice and causing an error.
 
Next insert 
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
in your form as normal.
 
I am assuming we are using dreamweaver here as this is the most common application that creates forms that post to the same page.
My example here is from a registration page which creates an insert into database behaviour, so next we need to find where dreamweaver sets up the insert statement.
 

<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "frmregister") Then
  MM_editConnection = MM_ConnTenerife_STRING
  MM_editTable = "Members"
  MM_editRedirectUrl = "mailform.asp"
  MM_fieldsStr  = "fldregusername|value|fldregpassword|value|fldname|value|fldemail|value"
  MM_columnsStr = "fldusername|',none,''|fldpassword|',none,''|fldName|',none,''|fldEmail|',none,''"
  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next
  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.Querystring <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.Querystring <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.Querystring
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.Querystring
    End If
  End If
End If
%>
 
incidentally for those of you wanting to pass form variables to another page after the insert (which you can't do with code generated by dreamweaver) then change the blue bits of the code above to
Request.Form
and now you can Smile I use this myself on this registration page and after the new record is inserted it passes the form variables to a page that sends the new user a confirmation email.
anyway, i digress, back to the CAPTCHA.
 
Find the code above and add the bits in red in this next section of code

 <!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "frmregister") Then
If blnCAPTCHAcodeCorrect = True Then
  MM_editConnection = MM_ConnTenerife_STRING
  MM_editTable = "Members"
  MM_editRedirectUrl = "mailform.asp"
  MM_fieldsStr  = "fldregusername|value|fldregpassword|value|fldname|value|fldemail|value"
  MM_columnsStr = "fldusername|',none,''|fldpassword|',none,''|fldName|',none,''|fldEmail|',none,''"
  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
 
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next
  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.Querystring <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.Querystring <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.Querystring
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.Querystring
    End If
  End If
ElseIf  blnCAPTCHAcodeCorrect = False Then
   Response.Redirect("wrongcode.asp")
  End If
End If
%>
 
That's it, done Smile


Edited by -boRg- - 19 December 2006 at 9:03am
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: 28 November 2006 at 6:58am
Thanks, Davecl...

But I'm not even doing the database thing. We've been using WebAssist Universal Email to simply generate an email to the client based on the info entered into the form. They just use the info they get by email to contact the prospect. No database.

Spammers have started to post to the form, hence we want to use CAPTCHA. But, even tho there's no database, we still get the "name redefined" thing.

I just need help getting the CAPTCHA to prevent scripts from using the form. Nothing more. So all the insert stuff is not pertinent.

Is that any clearer? Can anyone help with this one?

BTW, if you haven't guessed by now, I'm a designer, not a coder...

TIA...


Edited by bobmac - 28 November 2006 at 6:59am
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: 29 November 2006 at 6:38am
hi bob
 
does the form post to the same page or another page??
 
pm me the code if you like and i'll take a look if i get chance
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: 19 December 2006 at 1:56pm
Dave -

This is a very interesting solution to the issue of duplicate calls to CAPTCHA_Setup.asp.  I wonder, though...it looks to me as though you're cutting the include file from the first place it's called - the form processor file - and leaving it in the second place it's called (the actual CAPTCHA include file).  This seems counter-intuitive to me...

If I have a single-page e-mail form, then the default assumption is that the form is NOT populated...which would mean that I want the first call to the setup file to be located in the CAPTCHA include file.  BUT, the form processor has to be included outside the ASP blocks, before any of the processing code.  So wouldn't eliminating the include from the processor prevent submitted forms from completing (since the setup file is not included and thus variables aren't declared)?

I'm thinking that if you want the variables to always be declared but only sometimes be referenced by the included CAPTCHA, you'd want to leave the setup include IN the process_form.asp and take it OUT of the CAPTCHA  include; precisely the opposite of what you've done here.  It seems like the way you've got it here, a posted form won't process because the required include is...well, never included.

What am I missing here, other than I could solve my whole issue by just creating a two-page form process instead of trying to stuff it all in one, which is probably a better method of doing things anwyay?Wink


Edited by lowgenius - 19 December 2006 at 1:59pm
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: 19 December 2006 at 3:35pm
mm interesting
 
firstly the easy bit.. we are using a page with the form and processing on the same page because that is how dreamweaver does things and we are assuming that this is the reason why people want to know how to use the captcha on such a pageBig%20smile
 
your main point tho is a bit harder to understand.
 
we need the variables declared, but only once which is why i removed
<!-- #include file="CAPTCHA_setup.asp" --> from the processing file, this include is "included" in the main captcha file which you place in your form and so the variables are declared then. there is no need to declare them again and so once the form is being processed the include is no longer called and everything proceeds as it should.
I haven't tried it the other way round as you suggest because this was the first way i tried and it worked successfully, forms are processed and everything seems to work fine.


Edited by Davecl - 19 December 2006 at 3:35pm
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: 19 December 2006 at 3:59pm
I just did it the other way around, and that seems to work too ;-)

Maybe the reason that this is confusing is that on my single-page feedback form, if the user has submitted information in the form, the form does not appear in the confirmation page - feel free to try it out at www.lowgenius.com/contact.asp.  The actual form is in a block of code that is nested inside an 'else' statement - if the form has been submitted and has a value in the required field, then the form never displays...which would make the CAPTCHA include also never display, which means the setup file never fires.

What I did instead was removed the setup include from the captcha file, but not from the processing file.  Since the processing file is read whether a form has been submitted or not (it just never uses the created variables if not) then the variables are always declared, regardless of the post status of the form.

If you'd like, I can post an abridge code sample, but I suspect that you're understanding what i've done without that.
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: 19 December 2006 at 5:47pm
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
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.