Classic ASP ReCaptcha - Validation

0
August 18, 2011

Hi All.

I am no Developer and the question I am asking is beyond my current technical ability for ASP.

I have been trying to implament ReCaptcha to the contact page of my site.

I have been able to display the ReCaptcha api but I have the issue where reagrdless of what you type into the api the form still posts without any validation.

I do not know where to insert this valication requirement as stated on the Classic ASP FAQ's on the recaptcha.net site.

I have had no replies to my posts on other sites and at a lose end as to what to do and require some hand holding to make it work.

I have attatched the code used in my post.asp page.

Any guidance or even a swift correction of the code to me will be very, very much appreciated.

I inherited this site and it's code from someone else and the commenting within the code is very poor.

My appreciation in advance.

Regards

Colin

<!--#include file="incs/validation/validate.class.asp" -->

<!--#include file="incs/issame.fun.asp" -->

<%

'Option Explicit

' Declare Variables

Dim ValForm

Dim Error_messages

Dim Error_count

Dim IsError

Dim javascriptstring

Set ValForm = New ValidateRequest



' Set Preferences

' Set the form Name

ValForm.FormName = "form1"



' ***********************************************************

' ********************** Example ****************************

' ***********************************************************



'  Setup form field validation - properties and methods



'ValForm.ElementName = "ElementName"      ' Set the name of the form element

'ValForm.ElementType = "text"                 ' Set the element type (used for client side JS) - text, textarea, radio, checkbox, select - There is also a number type.  "number" changes the way the min and max work to greater than less than and also changes the behaviour of the required property to Number Required



'ValForm.Val_Required = TRUE                ' Set Val_Required = true if mandatory

'ValForm.Alt_Required = "mobile,office"       ' CSV alternative fields that can be used!

'ValForm.Msg_Required = "My custom message"   ' Set Msg_Required if you want a custom message - This is optional (Although the default isn't very good)



'ValForm.Val_Email = TRUE                   ' Set Val_Email = TRUE to check for a valid email address

'ValForm.Msg_Email = "My custom message"  ' Set Msg_Email if you want a custom message (optional)



'ValForm.Val_Min = 3                        ' Set the minimum number of characters for a valid input  

'ValForm.Msg_Min = "My custom message"        ' Set Msg_Min if you want a custom message (optional)



'ValForm.Val_Max = 25                       ' Set the maximum  number of characters for a valid input

'ValForm.Msg_Max = "My custom message"        ' Set Msg_Max if you want a custom message (optional)



'ValForm.Val_Regexp = "[a-zA-Z]"          '

'ValForm.Msg_Regexp = "My custom message" ' Set Msg_Max if you want a custom message (optional)



'ValForm.Val_Date   = TRUE                  ' Only allow valid dates if set to true

'ValForm.Msg_Date   = "My custom message" ' Set Msg_Date if you want a custom message (optional)



' valForm.bool_Validate                     ' You must call validate at the end of each element - This will return true (success) or false if the element fails the above criteria - Set this to a variable if you want to know if this element has failed.





' ***********************************************************

' ********************** End Example ************************

' ***********************************************************



' Set name element

ValForm.ElementName     = "name"

ValForm.ElementType     = "text" 

ValForm.Val_Required    = TRUE

'ValForm.Msg_Required   = "Please enter your name!"

ValForm.Val_Min = 3

ValForm.Msg_Min = "Your name must be greater than 3 letters!"

ValForm.Val_Max = 10

ValForm.Msg_Max = "We only accept people with names under 10 letters ;-)"

valForm.bool_Validate



' Set email element

ValForm.ElementName     = "email"

ValForm.ElementType     = "text" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "Please enter your email address!"

ValForm.Val_Email       = TRUE

ValForm.Msg_Email       = "Please enter a valid email address!"   

emailCool = valForm.bool_Validate



' Set telephone element

ValForm.ElementName     = "landline"

ValForm.ElementType     = "text" 

ValForm.Val_Required    = TRUE

ValForm.Alt_Required    = "mobile,office"

ValForm.Msg_Required    = "Please enter at least 1 telephone number!"

valForm.bool_Validate



' Set postcode element

ValForm.ElementName     = "postcode"

ValForm.ElementType     = "text" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "Please enter your postcode!"

ValForm.Val_Regexp      = "^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$"     '

ValForm.Msg_Regexp      = "Please enter a valid postcode!"    

valForm.bool_Validate



' Set notes element

ValForm.ElementName     = "notes"

ValForm.ElementType     = "text" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "Please enter some notes!"

valForm.bool_Validate



' Set number element

ValForm.ElementName     = "number"

ValForm.ElementType     = "number" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "Please enter numbers only!"

ValForm.Val_Min = 3

ValForm.Msg_Min = "Please enter a value greater than 3!"

ValForm.Val_Max = 10

ValForm.Msg_Max = "Please enter a number less than 10"

valForm.bool_Validate



' Set date element

ValForm.ElementName     = "date"

ValForm.ElementType     = "text" 

ValForm.Val_Date        = TRUE

ValForm.Msg_Date        = "Valid dates only!"

valForm.bool_Validate



' Set rating element

ValForm.ElementName     = "rating"

ValForm.ElementType     = "radio" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "You must rate this class"

valForm.bool_Validate



' Set component element

ValForm.ElementName     = "component"

ValForm.ElementType     = "checkbox" 

ValForm.Val_Required    = TRUE

ValForm.Msg_Required    = "Please let us know what you think of our validation class!"

valForm.bool_Validate



' Finish up



' str_client_script Returns the client side JavaScript - assign to a variable  and write the varable in the head of your HTML doc

javascriptstring = valForm.str_client_script("form_check") ' What ever name you pass in will the the JS function name

' Get the error count

error_count = valForm.int_error_count

' dict_get_errors returns a dictionary object with name value/pairs of the 'element name' and 'error messages '

Set Error_messages = valForm.dict_get_errors

' Clean Up

Set ValForm = Nothing









' Check if there has been an error

Dim MyMSG

If Request.Form.Count > 1 Then
If error_count = 0 Then
    ' Do success code
    MyMSG = "<h1>Form Validated Successfully</h1>"
Else
    ' The validation has failed
    MyMSG = "<h1>There are "&(error_count)&" errors in this form!</h1>"
End If

End If

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Example Validation Script</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<% = javascriptstring %>

<link href="css/validation.css" rel="stylesheet" type="text/css">

<style type="text/css">

<!--

.smallprint {font-size: 9px; color: #666666}

.OptRequired{color:#3300FF;}

th{

background-color: #666666;

color: #FFFFFF;

}

td{

background-color: #CCCCCC;

}

td.notes{

background-color:#FFFFCC;

}

-->

</style>

</head>



<body>

<div align="center">

<%=MyMSG%>

</div>

<form name="form1" action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post" onSubmit="return form_check();">

  <table border="0" align="center" cellpadding="3" cellspacing="2">

    <tr align="left" valign="top">

      <th nowrap scope="row">Name <span class="required">*</span> </th>

      <td bgcolor="#CCCCCC"><input name="name" type="text" id="name" value="<%=Request("name")%>"><% =(Error_messages.item("name")) %>        </td>

      <td class="notes">Value Required & Must be more than 3 Chars, less than 10</td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">
  <% 
  ' This is an alternative method for messages
  If emailCool Then 
  %>
  Email <span class="required">*</span> 
  <% Else %>
  Valid Email only please
  <% End If %>
  </th>

      <td bgcolor="#CCCCCC"><input name="email" type="text" id="email" value="<%=Request("email")%>">        <% =(Error_messages.item("email")) %>        </td>

      <td class="notes">Required & Valid Email test </td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Tel - Land Line <span class="OptRequired">*</span></th>

      <td bgcolor="#CCCCCC"><input name="landline" type="text" id="landline" value="<%=Request("landline")%>">

        <% =(Error_messages.item("landline")) %></td>

      <td class="notes">Users must enter a landline, office or mobile number . </td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Office <span class="OptRequired">*</span></th>

      <td bgcolor="#CCCCCC"><input name="office" type="text" id="office" value="<%=Request("office")%>">

        <% =(Error_messages.item("office")) %></td>

      <td class="notes"><span class="smallprint">To do this comma seperate the optional filelds in the property: .Alt_Required  = "mobile,office"</span></td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Tel - Mobile <span class="OptRequired">*</span></th>

      <td bgcolor="#CCCCCC"><input name="mobile" type="text" id="mobile" value="<%=Request("mobile")%>">

        <% =(Error_messages.item("mobile")) %></td>

      <td class="notes"> </td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">PostCode <span class="required">*</span> </th>

      <td bgcolor="#CCCCCC"><input name="postcode" type="text" id="postcode" value="<%=Request("postcode")%>">

        <% =(Error_messages.item("postcode")) %></td>

      <td class="notes">Required & RegExp Validation<span class="style4"> <span class="smallprint">("^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$"</span>) </span></td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Notes <span class="required">*</span> </th>

      <td bgcolor="#CCCCCC"><textarea name="notes" id="notes"><%=Request("notes")%></textarea>

      <% =(Error_messages.item("notes")) %></td>

      <td class="notes">Required </td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Number</th>

      <td bgcolor="#CCCCCC">
  <input name="number" type="text" id="number" value="<%=Request("number")%>" />
  <% =(Error_messages.item("number")) %>
  </td>

      <td class="notes">Numbers Only & Value must be greater than 3 less than 10. <br>

        <span class="smallprint">By setting the .ElementType    = "number" The required function will only accept numbers & the Min / Max functions changes from number of characters to numerical value. </span></td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Date</th>

      <td bgcolor="#CCCCCC">
  <input type="text" name="date" onBlur="checkdate(this)" size=11 maxlength=11 value="<%=Request("date")%>">

        <% =(Error_messages.item("date")) %></td>

      <td class="notes">Verifies valid dates </td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">Rating <span class="required">*</span> </th>

      <td bgcolor="#CCCCCC">1

      <input name="rating" type="radio" value="1" <% = TickMe("1",Request("rating")) %>>

      2

      <input name="rating" type="radio" value="2" <% = TickMe("2",Request("rating")) %>>

      3

      <input name="rating" type="radio" value="3" <% = TickMe("3",Request("rating")) %>>

      4

      <input name="rating" type="radio" value="4" <% = TickMe("4",Request("rating")) %>>

      5

      <input name="rating" type="radio" value="5"<% = TickMe("5",Request("rating")) %>>
  <% =(Error_messages.item("rating")) %> 
  </td>

      <td class="notes">Required<span class="smallprint"> (example of required working with .ElementType    = "radio" )</span></td>

    </tr>

    <tr align="left" valign="top">

      <th nowrap scope="row">This component is: <span class="required">*</span> </th>

      <td><p>
  <% MyArray = Split(Request("component"),",") %>

          <input name="component" type="checkbox" id="component" value="1" <% = TickMe("1",MyArray) %>> 

          Easy to use

</p>

        <p>

          <input name="component" type="checkbox" id="component" value="2" <% = TickMe("2",MyArray) %>>

Time saving       </p>

        <p>

          <input name="component" type="checkbox" id="component" value="3" <% = TickMe("3",MyArray) %>>

Less prone to coding errors     </p>

        <p>

          <input name="component" type="checkbox" id="component" value="4" <% = TickMe("4",MyArray) %>>

Easy to maintain      </p>

        <p>

          <input name="component" type="checkbox" id="component" value="5" <% = TickMe("5",MyArray) %>>

Bug free ;-)      </p>

        <p>

          <% =(Error_messages.item("component")) %> 

        </p>
  </td>


  <td class="notes">Required <span class="smallprint">(example of required working with .ElementType    = "checkbox" ) </span></td>

    </tr>

    <tr align="left" valign="top">

      <th align="center" valign="middle" nowrap scope="row"><input type="submit" name="Submit" value="Submit"></th>

      <td bgcolor="#CCCCCC" class="required">* = Required! <br>

        <span class="OptRequired">* = At least 1 Required! </span></td>

      <td class="notes"> </td>

    </tr>

  </table>

</form>

</body>

</html>

13

answers

Comments See all(0)

Add comment
0
August 18, 2011

I cannot get my example to work, for some weird reason.

Give this a test

http://www.worldofcode .com/wp-co ntent/uplo ads/2008/0 4/ recaptch aclassic asp.zip

Add

in your information to the 2 pages.

pubkey and privkey

Then run it.

Then implement your code into this one.

That will be the best way to go about it.

This will also help you to troubleshot your issues with your current code as well.

Keep one thing in mind.

It all goes by how you have this implemented, on rather it will work properly or not.

Good Luck

Carrzkiss
0
August 18, 2011

HI carrzkiss,

Thanks for the suggestion, but I have already looked at this and it's still alittle beyond me.

I would be much happier if someone could look at my code and resolve it from there.

I am quite happy to pay for this.

Regards

Colin

0
August 18, 2011

You stated:

>> I have been able to display the ReCaptcha api

I do not see it in the code that you have provided.

If you can provide me with a working code as you want it, I can see what I can do.

Just supply a working example, in a zip file (You have to rename all .asp   to   .asp.txt

In order to upload the zip file here.)

It is a lot easier to start from something that is actually working, then from something that is just a lot of code.

Good Luck

Carrzkiss

0
August 18, 2011

Hi Carrzkiss,

Apologies, but I think I sent the wrong code in the original post!!

The site url where this can be seen is

www.florida-villa.us.com

. On the home page left column is a Quick Reservations form. Click submit from there and will then post the select into the post.asp page. Here you will see the API.











What ever you type into the API or even select SUBMIT the page will not be challenged.











So the file I have uploaded is the POST.ASP. In this I have commented in CAPS what I have added and where the final part of the action in the form takes place.











The guide I refer to on the recaptcha website is this url 

http://code.google.com/api s/recaptch a/docs/asp .html

Regar











ds











Colin
Attachments
0
August 18, 2011

I am looking into it now.

Will get back with you in a little while.

0
August 18, 2011

arthursc0

You stated in the post above that:

>> I am quite happy to pay for this.

I have this working, but the way you have it done, is very dangerous and could get attacked by: SQL or XSS Injections.

If you are willing to pay me for my time on this one, I will write you up a good script with information on how it works.

Let me know, before I go further in the coding process...

Carrzkiss

0
August 18, 2011

by the way.

Browse my profile for my email address.

(You cannot post email address's in the threads, against ee rules)

Carrzkiss

0
August 18, 2011

Email sent.

0
August 18, 2011

Hi carrkiss

did you get my email??

Regards

Colin.

0
August 18, 2011

Hello Colins.

Yes and I replied back, did you not receive it?

I will send it back to you again.

0
August 18, 2011

I just resent the message, make sure that you check your spam folder as well

As some filters catch it.

You should get a message from

EE's Very Own Carrzkiss

Carrzkiss

0
August 18, 2011

I am going to send you an email through my hotmail account.

As it seems that you are unable to receive mail from my domain accounts.

Talk to you soon, I think??

0
August 18, 2011

Got them both..

Related Questions

This is the very first question

Hello guys! This is the first post in this site Read More

Views

2k

Votes

4

Answers

2

January 08, 2016

report values not showing up.

I have a crystal report which I pass a DataSet to using VB.NET. The report was working fine, but then I make some changes to the import query and now nothing shows up in the crystal report. Crystal do Read More

Views

1k

Votes

0

Answers

12

September 06, 2005

Event log doesn't overwrite as needed in SP4

Hello All, After upgrading from SP3 to SP4 on several Windows 2000 PRO machines everything looked fine, but from time to time applications can&#39;t write to the event log. When I try to view the appl Read More

Views

1k

Votes

0

Answers

9

May 11, 2003

"Failed to self-register XYZ.dll"

Hi there, I wrote a OLE-automation-server DLL in VB4.0. I use Installshield Express to install it as part of my program on the target computers. Now on some computers I get the message &quot;Failed to Read More

Views

2k

Votes

0

Answers

2

November 08, 1998

Please help understand these notes on image processing

Can someone please help me understand these lecture notes... On the right of the page; What does &quot;normalised by one notion of the area of a pixel&quot; mean? On the first formula for A, Is that a Read More

Views

1k

Votes

0

Answers

3

February 05, 2009

Can someone please explain this paragram on the chain rule in image processing

Please see the screenshot, How is 3133030 got from 10103322? Read More

Views

1k

Votes

0

Answers

1

January 05, 2009

AD on 2003

We have created an AD Domain on Windows 2000 Server with no problems. We just created an AD Domain on Windows 2003 and we&#39;re getting some weird problems. Both of these domains are behind firewalls Read More

Views

1k

Votes

0

Answers

15

May 11, 2003

ADDT ASP Upload Error " Type mismatch: 'tNG_isFileInsideBaseFolder' "

I am trying to create a simple insert record and upload image function on an ASP page built using Adobe Dreamweaver Developer Toolkit. I have done this many times before with no problem, however, i ha Read More

Views

1k

Votes

0

Answers

0

November 02, 2008

MYSQL Select query with custom ORDER BY

Hi, is it possible to customize the order of the returned rows in mysql? Example: I have a Table with a column &quot;name&quot;, now I want to have all entries ordered by name, but I want the entries Read More

Views

1k

Votes

0

Answers

5

July 02, 2010

Folder Redirection in Server 2003

We have a Windows Server 2003 Standard Ed. Is there a way to redirect the users my documents to a folder that has already been created on the server? Read More

Views

1k

Votes

0

Answers

2

July 05, 2007

Partiton magic  version 8.0 having error 1523 while executing batch

I followed the partition magic 8.0 wizard to partition my hard disk while rebooting &#160;I came across this problem &#160;&quot;error 1523 while executing batch&quot; What can I do to solve this prob Read More

Views

1k

Votes

0

Answers

2

May 11, 2003

Please explain this paragraph in image processing (screenshot attached)

Two questions; How is the equation (10.1-15) formed? &quot;are isotropic for rotation increments of 90 degrees and 45 degrees respectively&quot; What does this mean Read More

Views

809

Votes

0

Answers

7

January 05, 2009

xp_cmdshell with net use

Hi, when I use &#39;net use \192.168.0.1\c$ password /user:username&#39; at the command prompt, it works fine. &#160;But if i try to use it in sql with &quot; exec master..xp_cmdshell &#39;net use \19 Read More

Views

756

Votes

0

Answers

5

April 11, 2003

hp ux11

i have a hp ux11 server. and i edited the /etc/resolv.conf to use my win2003 server dns server. That went fine, however, I would like to go the other way and add an entry on my win2003 dns to resolve Read More

Views

441

Votes

0

Answers

3

October 12, 2009

Using an application over a LAN

I have written an application that needs to be used on a LAN. &#160;The application setup wizard takes care of registering everything on a single PC, but how do you go about writing a setup program th Read More

Views

387

Votes

0

Answers

9

August 07, 1998

Need subnet of 12 IPs.

Please, Can someone help me to create a subnet consisting of 12 IP&#39;s. Thanks.. Read More

Views

396

Votes

0

Answers

5

April 11, 2003

Drill down in a cross-tabl report

Hello, Would some experts to show me if it is possible to do drill-up or drill-down (or both) in a cross-tab report? I would also like to know if it is possible to control what fields to be displayed/ Read More

Views

322

Votes

0

Answers

0

September 06, 2005

Using RDO, Enterprise V Professional

We would like to use RDO on our project made up of 4 developers. Do we need to have a copy of Enterprise for each developer or is it possible to use Professional for those developers not writing the R Read More

Views

378

Votes

0

Answers

6

January 07, 1998

Can't Edit IIS Metabase.xml

We do this on every windows 2003 server and never had an issue. We cannot edit the IIS Metabase.xml We have stopped IIS and made change click save, no problem but it does not take the new information. Read More

Views

377

Votes

0

Answers

0

July 05, 2007

copy directorires - HP UNIX

Let&#39;s say my source file is /A/B/C/D/file1, and mytarget directory is /E/F/G, I want the result should look like this. /E/F/G/A/B/C/D/file1 I am using rsync to copy the files older than x no of da Read More

Views

388

Votes

0

Answers

14

September 12, 2009