Web Wiz
Home
Home
Hosting Services
Hosting Services
Knowledgebase
Knowledgebase
Community and Support Forums
Support Forums
Customer Login
Customer Login

  New Posts New Posts RSS Feed - CAPTCHA with Single ASP webpage
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Windows Web Hosting 30 Day Free Trial

Windows Web Hosting 30 Day Free Trial

Windows Hosting 30 Day Free Trial, with no obligation, on all our Windows Web and Reseller Hosting Packages.

For moreĀ informationĀ see our Windows Hosting 30 Day Free Trial page.

CAPTCHA with Single ASP webpage

 Post Reply Post Reply Page  12>
Author
MrTWS View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 July 2007
Location: United Kingdom
Status: Offline
Points: 1192
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrTWS Quote  Post ReplyReply Direct Link To This Post Topic: CAPTCHA with Single ASP webpage
    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 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
Back to Top
mstuck View Drop Down
Newbie
Newbie


Joined: 01 February 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstuck Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2009 at 7:41pm
bump
Back to Top
mstuck View Drop Down
Newbie
Newbie


Joined: 01 February 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mstuck Quote  Post ReplyReply Direct Link To This Post 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">
<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","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%>
           
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Points: 7797
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jrcarr View Drop Down
Newbie
Newbie
Avatar

Joined: 17 July 2008
Location: Arkansas, USA
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote jrcarr Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Points: 7797
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jrcarr View Drop Down
Newbie
Newbie
Avatar

Joined: 17 July 2008
Location: Arkansas, USA
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote jrcarr Quote  Post ReplyReply Direct Link To This Post 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.
 
<%@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">
<html xmlns="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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Poole, England
Status: Offline
Points: 7797
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down



Become a Fan on Facebook Follow us on Twitter Find us on Google+ Community Forums Web Wiz Blogs Web Wiz News
Company Information | Contact Web Wiz | Terms & Conditions | Privacy Policy

Prices exclude VAT unless otherwise stated - $, € prices shown as a guideline only
Web Wiz Ltd, Unit 10E Dawkins Road Ind. Est, Poole, Dorset, UK, BH15 4JD
Copyright ©2001-2012 Web Wiz - All rights reserved