Print Page | Close Window

CAPTCHA and Option Explicit

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=21792
Printed Date: 28 March 2026 at 3:11pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: CAPTCHA and Option Explicit
Posted By: Tomcat
Subject: CAPTCHA and Option Explicit
Date Posted: 30 October 2006 at 8:54pm
I have installed the CAPTHCA files and the application works up to the time that the form variables are sent to CDONTS mail to be processed in my file:  http://www.volz.org/hauntedhouse/emailForm.asp - http://www.volz.org/hauntedhouse/emailForm.asp   This form uses Option Explicit
 
The link to my form is:  http://www.volz.org/hauntedhouse/feedback-org.asp - http://www.volz.org/hauntedhouse/feedback-org.asp
 
I have declared the variables in the email form body as follows:
 
'This is the CAPTCHA Code entered on the form
 Dim securityCode = strCAPTCHAenteredCode
 
But something is still amiss.  I get the error:
 

Microsoft VBScript compilation error '800a0400'

Expected statement

/hauntedhouse/emailForm.asp, line 4

Option Explicit
Are there other variables that I am missing?  I would
appreciate any help you can provide so that I can get the
application working properly.  Thanks.


-------------
Tomcat



Replies:
Posted By: WebWiz-Bruce
Date Posted: 31 October 2006 at 9:19am
You would need to use:-


Dim securityCode

securityCode = strCAPTCHAenteredCode




-------------
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: Tomcat
Date Posted: 31 October 2006 at 2:24pm
Unfortunately, I still get the same error:
 
 

Microsoft VBScript compilation error '800a0400'

Expected statement

/hauntedhouse/emailForm.asp, line 4

Option Explicit
^
It doesn't matter whether I place the code at the top of the file
or within the body.
What am I missing.  Should the variable be declared somewhere else?
Perhaps in the include file CAPTCHA_form_inc.asp?
Any help is greatly appreciated.


-------------
Tomcat


Posted By: WebWiz-Bruce
Date Posted: 31 October 2006 at 2:27pm
The simplest option is to remove the line option explicit 

-------------
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: Tomcat
Date Posted: 01 November 2006 at 5:01pm
I removed the Option Explicit statement and the errors did go away.
But in further troubleshooting this application, I noted that the form submits even though nothing is filled out in the CAPTCHA field.
 
http://www.volz.org/hauntedhouse/feedback-org.asp - http://www.volz.org/hauntedhouse/feedback-org.asp
 
Since the form was uploaded to the server, the email address for the form results has been clobbered by SPAM.
 
The installation of the application is going a lot rougher than I expected.
 
Shouldn't the ASP script test the CAPTCHA field for an unfilled field?  Or does there need to be an additional condition to test if the field is blank?
 
Also, the form results are sent where or not the CAPTCHA Code is correct or incorrect.  Where should the additional conditions be written?  It was my understanding that the ASP files supplied with the application do not need modification.
 
Any help you can provide is greatly appreciated.


-------------
Tomcat


Posted By: WebWiz-Bruce
Date Posted: 01 November 2006 at 6:32pm
The files supplied are only for demonstration.

You need to put in what happens if the CAPTCHA code is entered incorrectly.

If you have setup the CAPTCHA correctly then when you submit the form it will test to see if the CAPTCHA image has been entered correct, if the CAPTCHA image is correct the varaiable 'blnCAPTCHAcodeCorrect' is set to true.

So you need to write a condition into your software something like:-

If blnCAPTCHAcodeCorrect =  True Then
   
    Run code to send email

ElseIf blnCAPTCHAcodeCorrect = False Then

    Inform user the CAPTCHA code it wrong

End If


As the Web Wiz CAPTCHA is a generic application that could be used for lots of different things it's not possiable to supply it pre-done so to speak, so instead the variable 'blnCAPTCHAcodeCorrect' is set to true or false, you then need to write the code yourself as to what to or not do if the CAPTCHA image is not correct.


-------------
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