Previous Article Classic ASP md5 Hash Login Script |
Classic ASP, AJAX and ReCapTcha |
Next Article Send Email using ASP Classic and CDOSYS |
Coding Article #: 25 - Published On: October 07, 2011 @ 00:31:56 AM - Last Updated on: January 21, 2015
This article has been Favorited 29 timesJoin today, and add this to your favorites.
Share With Friends (Updated 6-8-2010)
This example will show you how to enable your form with the ReCapTcha to your ASP Classic, to help protect your forms from SPAM and other types of hacking attempts.
Included in this example, is the AJAX example, so everything is done through one page.
View Demo Page«
Check out the New reCaptcha 2.0«
The Form is basic, with AJAX added in, to submit the form and stay on the same page.
(In order to get all the code, you will need to be a member to download the available resources on the top right
There are 6 files total for this project)
Load.asp
We pass our form to the processing page named: pass.asp
This page contains the private and public key that we will check to make sure it gets submitted properly.
Pass.asp
Included in this example, is the AJAX example, so everything is done through one page.
View Demo Page«
Check out the New reCaptcha 2.0«
The Form is basic, with AJAX added in, to submit the form and stay on the same page.
(In order to get all the code, you will need to be a member to download the available resources on the top right
There are 6 files total for this project)
Load.asp
<form name="ContactForm" action="pass.asp" method="post" onSubmit="xmlhttpPost('pass.asp', 'ContactForm', 'Contactdiv', '<img src=\'graph/pleasewait.gif\'>'); return false;">
<label>Name</label>
<div><input class="FFields" type="text" name="ConName" /></div>
<div>Due to changes in the way <br />
the ReCaptCha has been developed, <br />
please click on the Circle to <br />
change the original CapTcha Code.<br />
<br />
Currently working to fix this issue!</div>
<label>ReCapTcha</label>
<div><%=recaptcha_challenge_writer(recaptcha_public_key)%></div>
<label>Submit Form</label>
<div><input class="FFields" type="Submit" name="Submit" value="Send Message" /></div>
<div id="Contactdiv"></div>
</form>
We pass our form to the processing page named: pass.asp
This page contains the private and public key that we will check to make sure it gets submitted properly.
Pass.asp
<%
recaptcha_challenge_field = Request("recaptcha_challenge_field")
recaptcha_response_field = Request("recaptcha_response_field")
recaptcha_private_key = "PRIVATE-KEY-GOES-HERE"
recaptcha_public_key = "PUBLIC-KEY-GOES-HERE"
cTemp = recaptcha_confirm(recaptcha_private_key, recaptcha_challenge_field, recaptcha_response_field)
ConName = Request.Form("ConName")
%>
<!--#include file="Utilities/Recaptcha.asp"-->
<%
if ConName = "" then
response.Write"Please provide your name"
else
if cTemp <> "" Then
response.Write"<strong>Incorrect CaPtChA</strong><br />Please make sure that you have typed the letters/numbers correctly.<br />If you have a hard time seeing the letters/numbers please do one of the following:<br />#1: click on the rotation symbol to change the sequence of the characters to another set.<br />#2: click on the speaker to have the characters spoken out to you."
else
response.Write"Information is Correct!"
end if
end if
%>
Post to Facebook about: Classic ASP, AJAX and ReCapTcha