Ernesto
asked on
validate recaptcha on server side
I need to validate my invisible recaptcha in server side
I have an native .asp file to get user data and email it,
how to validate the recaptcha in there?
I have an native .asp file to get user data and email it,
how to validate the recaptcha in there?
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
'conn.Provider="Provider=SQLOLEDB"
conn.Open "Provider=SQLOLEDB;data source=Comensaaasrios.mssql.soasaae.com;packet size=4096;user id=xxxx;pwd=xxxx;persist security info=False;initial catalog=xxxx"
sql="INSERT INTO comentarios (nombre, email,telefono, producto, comentario)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("telefono") & "',"
sql=sql & "'" & Request.Form("consultorio") & "',"
sql=sql & "'" & Request.Form("message") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("Error, Intente otro metodo de contacto!")
Response.Write("<a href='http://www.oncolosdsdsjio.com'><h3>Regresar a página de contacto.</h3></a>")
else
Response.Write("<h3>Nos pondremos en contacto lo antes posible.</h3>")
Response.Write("<a href='http://www.oncolosdsdsbajio.com'><h3>Regresar a Oncolosdsddsdsío.</h3></a>")
end if
conn.close
%>
<%
Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Tel,ContactUs_Email
Dim ContactUs_Subject,ContactUs_Body,Action,IsError
smtpserver = "smtp.gmail.com"
youremail = "esdsfsfsia@gmail.com"
yourpassword = "sdsfsdfs"
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'Use SSL for the connection
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "edfsfdasaldia@gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "ernfsestgdda5"
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "rdsdsaoz@hotmail.com;eddssdso60@hotmail.com"
ObjSendMail.Subject = "Mensaje de Contacto web"
ObjSendMail.From = "edesdsobsdsaldia@gmail.com"
ObjSendMail.HTMLBody ="Nombre:" +" " + Request.Form("fname") & Chr(10) & "<br>Email:" +" " + Request.Form("email") & Chr(10) & +" "+"<br>Teléfono:"+" "+ Request.Form("Telefono") & Chr(10) & "<br>Consultorio:" +" " + Request.Form("consultorio") & Chr(10) & "<br>Comentarios:" +" " + Request.Form("message")
ObjSendMail.Send
Set ObjSendMail = Nothing
%>
</body>
</html>
there is nothing in your submitted code that refers to a reCAPTCHA
ASKER
Help!!!
Recaptcha is not working
how to test it?
Recaptcha is not working
how to test it?
Post the code or check google guidelines https://developers.google.com/recaptcha/old/docs/asp
Also as a tip, try not to past your connection string credentials publicly, or emails, etc.. for your own peace of mind.
Also as a tip, try not to past your connection string credentials publicly, or emails, etc.. for your own peace of mind.
ASKER
all conections are fake!!!
I know
let me chek!
I know
let me chek!
ASKER
Those are my callings
This is my form
please what else for invisible recaptcha work!!
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function captchaSubmit(data) {
document.getElementById("simpeleForm").submit();
}
</script>
<style>
.grecaptcha-badge {
display: none;
}
</style>
This is my form
please what else for invisible recaptcha work!!
<form formid="simpleForm" method="post" action="contact.asp">
<div class="g-recaptcha"
data-sitekey="6Lccr3wUAAAAAOPtAcLfhRgG1N9q49kVmVYZpOeQ"
data-callback="onSubmit"
data-size="invisible">
</div>
<b>Envíenos un mensaje</b> <span></span>
<input type="text" name="fname" id="fname" required placeholder="Nombre">
<input type="email" name="email" id="email" required placeholder="Dirección de Email">
<input type="text" name="telefono" id="telefono" required placeholder="Teléfono">
<select name="Consultorio" type="text" id="consultorio">
<option>Elija Consultorio...</option>
<option>Querétaro</option>
<option>San Miguel</option>
</select>
<!--<textarea name="message" id="message" placeholder="Escriba aquí su mensaje..." rows="10" cols="30"> </textarea>-->
<textarea name="message" id="message" rows="4" cols="50" required placeholder="Escriba aquí su mensaje..."></textarea>
<button class="g-recaptcha" data-sitekey="6Lccr3wUAAA1N9q49kVmVYZpOeQ" data-callback="captchaSubmit" data-badge="inline">Enviar</button>
</form>
ASKER
I dont get this part please!
Site Verify Response
Make the request to verify the response token as with reCAPTCHA v2 or Invisible reCAPTCHA.
The response is a JSON object:
{
"success": true|false, // whether this request was a valid reCAPTCHA token for your site
"score": number // the score for this request (0.0 - 1.0)
"action": string // the action name for this request (important to verify)
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}
Site Verify Response
Make the request to verify the response token as with reCAPTCHA v2 or Invisible reCAPTCHA.
The response is a JSON object:
{
"success": true|false, // whether this request was a valid reCAPTCHA token for your site
"score": number // the score for this request (0.0 - 1.0)
"action": string // the action name for this request (important to verify)
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}
ASKER
Please help!!!
Reading the docs https://developers.google.com/recaptcha/docs/v3
There is a link to verify https://developers.google.com/recaptcha/docs/verify using the back end. The docs on that page show you will post to https://www.google.com/recaptcha/api/siteverify with the fields:
The way this should work for you is when the button is clicked, use javascript to intercept the click and submit to a processing page that will send an xmlhttp post to the google url with the fields indicated. The parse the response you get back and if it is ok, then continue to process the form data.
- Load the JavaScript api with your sitekey
- Call grecaptcha.execute on an action or when the page loads
- Send the token to your backend with the request to
- verify
There is a link to verify https://developers.google.com/recaptcha/docs/verify using the back end. The docs on that page show you will post to https://www.google.com/recaptcha/api/siteverify with the fields:
- secret Required. The shared key between your site and reCAPTCHA.
- response Required. The user response token provided by the reCAPTCHA client-side integration on your site.
- remoteip Optional. The user's IP address.
The way this should work for you is when the button is clicked, use javascript to intercept the click and submit to a processing page that will send an xmlhttp post to the google url with the fields indicated. The parse the response you get back and if it is ok, then continue to process the form data.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.