Print Page | Close Window

CAPTCHA with Single ASP webpage

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=24008
Printed Date: 29 March 2026 at 4:23am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: CAPTCHA with Single ASP webpage
Posted By: sdv86
Subject: CAPTCHA with Single ASP webpage
Date Posted: 31 July 2007 at 4:42pm
Hi--I hope someone can help me...

Per basic integration I need to place:
<!-- include the Web Wiz CAPTCHA form element -->
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
where I wish the CAPTCHA image to be...

and

<!-- Include file for CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
where I wish the processing to take place for my webform.

Unfortunately I don't have two webpages.  I have a single ASP file which pulls data from a Microsoft Access database.  I have placed the top code near the submit form and thats set, but when I place the bottom code into the document header, I receive an error:

Microsoft VBScript compilation error '800a0411'

Name redefined

/CAPTCHA/CAPTCHA_license.asp, line 46

Const strLicense = ""
------^

The ASP file I am using is located here.  Any ideas?  Thank you!  http://asp101.com/samples/viewasp.asp?file=db_paged_search.asp



Replies:
Posted By: WebWiz-Bruce
Date Posted: 31 July 2007 at 6:51pm
Try place the code you submit to on a second page, otherwise because the files are including the same files you will get errors like this.

-------------
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: sdv86
Date Posted: 01 August 2007 at 3:39am
Done, unfortunately it didn't work.  Same error.  Any other ideas?  Thank you!


Posted By: WebWiz-Bruce
Date Posted: 01 August 2007 at 7:41am
Now go through the installation instructions again, you only include those files required for the page in question.

-------------
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: jrcarr
Date Posted: 17 July 2008 at 9:33pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

Try place the code you submit to on a second page, otherwise because the files are including the same files you will get errors like this.
 
I'm sorry, but I didn't seem to have much trouble getting this code to work on a single form/results page.   I write the majority of my code to all run within a single page, instead of having to have 2 pages for everything.  I work on site with 100 or more pages, it's real hard to track that, let alone twice that many.
 
Here is a very basic layout using a copy of example.asp page as example2.asp and changed the action="example2.asp" in the <form> so that there isn't a second page involved.   My page(s) that I am using it on are far more complicated that this example, so I know it will work on about any single page.  The one page I am testing it in uses SQL Connections, DataSets, Error checking on the rest of the Form input as well.
 
< mailto:%@LANGUAGE=VBSCRIPT - %@LANGUAGE="VBSCRIPT " %>
<!-- Include file for CAPTCHA configuration -->
<!-- #include file="CAPTCHA/CAPTCHA_configuration.asp" -->
<!-- Include file for CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->          
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd - http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml - http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Web Wiz CAPTCHA Demo</title>
<style type="text/css">
<!--
.title {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
.header {font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; }
.text {font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.small {font-size: 10px}
body { background-color: #CCCCCC; }
-->
</style>
</head>
<body>
<div style="text-align:center;" class="header"> Web Wiz CAPTCHA <br />
  <br />
</div>
<form action="example2.asp" method="post" name="form1" id="form1">
  <table width="300" border="0" style="text-align:center; background-color:#000000;" cellpadding="3" cellspacing="1">
    <tr>
      <td style="background-color:#FFFFFF;"><table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr>
            <td><span class="title">Demo Form</span></td>
          </tr>
          <tr>
            <td><span class="text">Name:</span>
              <input type="text" name="name" value="<%= Request.Form("name")%>" /></td>
          </tr>
          <tr>
            <td class="text"> Enter the code exactly as you see it in the image:-<br />
                <span class="small">(Cookies must be enabled)</span><br />
               
<!-- include the Web Wiz CAPTCHA form -->
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
           </td>
          </tr>
          <tr>
            <td align="center"><input name="Submit Form" type="submit" id="Submit Form" value="Submit" />
            </td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
<%
'If CAPTCHA is entered correctly run the following code
If Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = True Then
       'Place code here that is to run if CAPTCHA is entered correctly
       Response.Write(request.Form("name")& ": The CAPTCHA code is correct")

'If CAPTCHA is NOT entered correctly run the following code
ElseIf Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = False Then
       'Place code here that is to run if CAPTCHA is NOT entered correctly
       Response.Write(request.Form("name")& ": The CAPTCHA code is NOT correct")
End If
%>
</body>
</html>
 
Jack


Posted By: WebWiz-Bruce
Date Posted: 18 July 2008 at 7:55am
This is a very old post you are dragging up from almost a year ago.

Since this post version 4 of Web Wiz CAPTCHA has been released which does support submitting the contents back to the same page/file.


-------------
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: jrcarr
Date Posted: 18 July 2008 at 5:58pm
Originally posted by WebWiz-Bruce WebWiz-Bruce wrote:

This is a very old post you are dragging up from almost a year ago.

Since this post version 4 of Web Wiz CAPTCHA has been released which does support submitting the contents back to the same page/file.
 
And this is very nice, but I hadn't found any where that this is stated.  I apologize.


Posted By: WebWiz-Bruce
Date Posted: 21 July 2008 at 8:48am
I've just had a look and you are correct.

Will need to make sure that this is more obvious with this new release.

Thanks for pointing this out.


-------------
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: mstuck
Date Posted: 01 February 2009 at 12:55am

Hello ASP newb here, I'm trying to implement ww captcha on a one page form that has required fields. I am using ASPmail to send the mail. By experimenting with the code above I can get captcha to pass or fail the code but I can't get it to start my required feild validation and then if all passes send the email. You mention that version 4 supports one page use but I cannot find any KB article or instructions on how to implement it. Below is an edited version of my code any direction is greatly appriciated. Thank you,

<!-- Include file for CAPTCHA configuration -->
<!-- #include file="CAPTCHA/CAPTCHA_configuration.asp" -->
<!-- Include file for CAPTCHA form processing -->
<!-- #include file="CAPTCHA/CAPTCHA_process_form.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd" rel="no follow - http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Contact Us</title>
edit code
 
 <!-- include the Web Wiz CAPTCHA form element -->
<!--#include file="CAPTCHA/CAPTCHA_form_inc.asp" -->
     
     &nbsp;<font size="2" face="arial,helvetica">
     <input name="submit" type="submit" value="Submit">
     </font></td>
                  </tr>
                  <font size="2" face="arial,helvetica">
                  <input type="hidden" name="Mode" value="Submit">
                  </font>
                </form>
              </table>
                  <font size="2" face="arial,helvetica"><BR>
      <%
'If CAPTCHA is entered correctly run the following code
If Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = True Then
     Errors = False
If Request("Mode") = "Send" And Request("eMail") = "" Then Errors = True
Errors = False
If Request("Mode") = "Send" And Request("Name") = "" Then Errors = True
Errors = False
If Request("Mode") = "Send" And Request("City") = "" Then Errors = True
Errors = False
If Request("Mode") = "Send" And Request("State") = "" Then Errors = True
Errors = False
If Request("Mode") = "Send" And Request("Country") = "" Then Errors = True
If Request("Mode") = "Send" And Errors = False Then
 REM ===== SEND AN EMAIL =====
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  'If Request("eMail") = "" Then eMail = "No E-Mail Given" Else eMail = Request("eMail")
  Mailer.FromName = Request("Name")
  Mailer.FromAddress = Request("eMail")
  Mailer.RemoteHost = "mail.xxxxxxx.com"
   Mailer.AddRecipient "TSF"," mailto:admin@XXXXXXX.com" rel="no follow - admin@XXXXXXX.com "
   
  Mailer.Subject = "Contact Form From Website" 
  
  mBody = "Name: " & Request("Name") & vbCrLf
  mBody = mBody & "Address: " & Request("Address") & vbCrLF
  mBody = mBody & "City: " & Request("City") & vbCrLF
  mBody = mBody & "State / Province: " & Request("State") & vbCrLF
  mBody = mBody & "Zip Code: " & Request("ZipCode") & vbCrLF
 mBody = mBody & "Country: " & Request("Country") & vbCrLF & vbCrLF
  mBody = mBody & "Phone: " & Request("DayPhone") & vbCrLF
  mBody = mBody & "Fax: " & Request("Fax") & vbCrLF
  mBody = mBody & "E-Mail: " & Request("eMail") & vbCrLF & vbCrLF
  mBody = mBody & "Comments: " & Request("Comments")
  
  Mailer.BodyText = mBody
  Mailer.SendMail
 Set Mailer = Nothing
End If
       Response.Write(request.Form("name")& ": The CAPTCHA code is correct")
'If CAPTCHA is NOT entered correctly run the following code
ElseIf Request("CAPTCHA_Postback") AND blnCAPTCHAcodeCorrect = False Then
       'Place code here that is to run if CAPTCHA is NOT entered correctly
       Response.Write(request.Form("name")& ": The CAPTCHA code is NOT correct")
End If
%>
                  <!-- END EMBEDDED TABLE (x) -->
                  <%End If%>
           


Posted By: mstuck
Date Posted: 02 February 2009 at 7:41pm
bump


Posted By: 123Simples
Date Posted: 03 February 2009 at 6:20pm
A lady from the states who I helped out with email verification had a similar issue. I think you will find it is because of the order that you are trying to process the form in

If you http://www.justcheck.co.uk/contact.asp" rel="no follow - click this link it shows how I implemented the coding to check the form contents FIRST before processing the captcha statement. Just try submitting the contact form first without filling in the required areas - you should get a javascript pop up saying you need to complete certain fields. Then if those fields are completed - it then continues the captcha end


-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design



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