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

Web Wiz 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
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
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
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 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
 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down



Become a Fan on Facebook Follow us on Twitter Web Wiz 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