<%
' On Error Resume Next
' Classsic ASP pages created by Andre F Bruton
' E-mail: andre@bruton.co.za
' Date: 2008/01/19
recaptcha_public_key = "API KEY BURAYA GELİYOR"
%>
<p align="center" id="yazi"><strong>
</strong></p>
<form id="form1" name="form1" method="post" action="kontrol.asp">
<table width="600" border="0" align="center">
<tr>
<th id="yazi" scope="col">Kullanıcı Adınız : </th>
<th scope="col"><label>
<input name="kullanici_adi" type="text" id="kullanici_adi" />
</label></th>
</tr>
<tr>
<th id="yazi" scope="col">Şifreniz : </th>
<th scope="col"><label>
<input name="sifre" type="password" id="sifre" />
</label></th>
</tr>
<tr>
</tr>
<tr>
<th id="norteks" scope="col"> </th>
<th scope="col"> </th>
</tr>
</table>
<% Else %>
<%end if %>
<center>
<%
' The code below supplied by Mark Short
' returns string the can be written where you would like the reCAPTCHA challenged placed on your page
function recaptcha_challenge_writer(publickey)
recaptcha_challenge_writer = "<script type=""text/javascript"">" & _
"var RecaptchaOptions = {" & _
" theme : 'white'," & _
" tabindex : 0" & _
"};" & _
"</script>" & _
"<script type=""text/javascript"" src=""http://api.recaptcha.net/challenge?k=" & publickey & """></script>" & _
"<noscript>" & _
"<iframe src=""http://api.recaptcha.net/noscript?k=" & publickey & """ frameborder=""1""></iframe><br>" & _
"<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _
"<input type=""hidden"" name=""recaptcha_response_field"" value=""manual_challenge"">" & _
"</noscript>"
end function
function recaptcha_confirm(privkey,rechallenge,reresponse)
' Test the captcha field
Dim VarString
VarString = _
"privatekey=" & privkey & _
"&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
"&challenge=" & rechallenge & _
"&response=" & reresponse
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.open "POST", "http://api-verify.recaptcha.net/verify", False
objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXmlHttp.send VarString
Dim ResponseString
ResponseString = split(objXmlHttp.responseText, vblf)
Set objXmlHttp = Nothing
if ResponseString(0) = "true" then
' They answered correctly
recaptcha_confirm = ""
else
' They answered incorrectly
recaptcha_confirm = ResponseString(1)
end if
end function
%> <br />
<th id="norteks" scope="col"> </th>
<th scope="col"><label>
<input name="Submit" type="submit" id="form1" value="Giris" />
</label></th>
</form>
<%=recaptcha_challenge_writer(recaptcha_public_key)%>fakat bu koda ben girilen veriyi doğrulatamadım. boş bile geçsen engellemiyor hiç bir şekilde. Elinde örnek olan var mı *
ASP içinde reCapthca Kullanımı
5
●1.178
- 17-08-2010, 13:47:07Üyeliği durduruldumerhaba. Kendi yazdığım ASP kodu içinde giriş kısmına reCaptcha yerleştirmek istiyorum. API keylerini falan aldım, internetten gerekli kodu buldum ;
- 17-08-2010, 14:52:24Üyeliği durdurulducap.asp:
<% ' On Error Resume Next ' Classsic ASP pages created by Andre F Bruton ' E-mail: andre@bruton.co.za ' Date: 2008/01/19 recaptcha_public_key = "API KEY BURAYA GELİYOR" %> <p align="center" id="yazi"><strong> </strong></p> <form id="form1" name="form1" method="post" action="kontrol.asp"> <table width="600" border="0" align="center"> <tr> <th id="yazi" scope="col">Kullanıcı Adınız : </th> <th scope="col"><label> <input name="kullanici_adi" type="text" id="kullanici_adi" /> </label></th> </tr> <tr> <th id="yazi" scope="col">Şifreniz : </th> <th scope="col"><label> <input name="sifre" type="password" id="sifre" /> </label></th> </tr> <tr> </tr> <tr> <th id="norteks" scope="col"> </th> <th scope="col"> </th> </tr> </table> <% Else %> <%end if %> <center> <% ' The code below supplied by Mark Short ' returns string the can be written where you would like the reCAPTCHA challenged placed on your page function recaptcha_challenge_writer(publickey) recaptcha_challenge_writer = "<script type=""text/javascript"">" & _ "var RecaptchaOptions = {" & _ " theme : 'white'," & _ " tabindex : 0" & _ "};" & _ "</script>" & _ "<script type=""text/javascript"" src=""http://api.recaptcha.net/challenge?k=" & publickey & """></script>" & _ "<noscript>" & _ "<iframe src=""http://api.recaptcha.net/noscript?k=" & publickey & """ frameborder=""1""></iframe><br>" & _ "<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _ "<input type=""hidden"" name=""recaptcha_response_field"" value=""manual_challenge"">" & _ "</noscript>" end function function recaptcha_confirm(privkey,rechallenge,reresponse) ' Test the captcha field Dim VarString VarString = _ "privatekey=" & privkey & _ "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _ "&challenge=" & rechallenge & _ "&response=" & reresponse Dim objXmlHttp Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objXmlHttp.open "POST", "http://api-verify.recaptcha.net/verify", False objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" objXmlHttp.send VarString Dim ResponseString ResponseString = split(objXmlHttp.responseText, vblf) Set objXmlHttp = Nothing if ResponseString(0) = "true" then ' They answered correctly recaptcha_confirm = "" else ' They answered incorrectly recaptcha_confirm = ResponseString(1) end if end function %>
örnek uygulama:
<!--#include file="cap.asp"--> <th id="norteks" scope="col"> </th> <th scope="col"><label> <input name="Submit" type="submit" id="form1" value="Giris" /> </label></th> </form> <%=recaptcha_challenge_writer(recaptcha_public_key)%> - 17-08-2010, 16:19:41Üyeliği durduruldubu şekilde denedim. boş geçiyorum ama yine de giriş yapabiliyorum.Phantasm adlı üyeden alıntı: mesajı görüntüle
- 17-08-2010, 18:12:27bir örnek oluşturdum test ettim çalışıyor.
form alanlarını kendine göre <form></form içerisinde düzenle.
recapcha public key ve private key bölümünü doldurmayı unutma.
<%
recaptcha_challenge_field = Request("recaptcha_challenge_field")
recaptcha_response_field = Request("recaptcha_response_field")
recaptcha_public_key = "buraya_public_key"
recaptcha_private_key = "buraya_private_key"
function recaptcha_challenge_writer()
recaptcha_challenge_writer = _
"<script type=""text/javascript"">" & _
"var RecaptchaOptions = {" & _
" theme : 'red'," & _
" tabindex : 0" & _
"};" & _
"</script>" & _
"<script type=""text/javascript"" src=""http://www.google.com/recaptcha/api/challenge?k=" & recaptcha_public_key & """></script>" & _
"<noscript>" & _
"<iframe src=""http://www.google.com/recaptcha/api/noscript?k=" & recaptcha_public_key & """ frameborder=""1""></iframe><>" & _
"<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _
"<input type=""hidden"" name=""recaptcha_response_field""value=""manual_ch allenge"">" & _
"</noscript>"
end function
function recaptcha_confirm(rechallenge,reresponse)
Dim VarString
VarString = _
"privatekey=" & recaptcha_private_key & _
"&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
"&challenge=" & rechallenge & _
"&response=" & reresponse
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.open "POST", "http://www.google.com/recaptcha/api/verify", False
objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXmlHttp.send VarString
Dim ResponseString
ResponseString = split(objXmlHttp.responseText, vblf)
Set objXmlHttp = Nothing
if ResponseString(0) = "true" then
recaptcha_confirm = ""
else
recaptcha_confirm = ResponseString(1)
end if
end function
server_response = ""
newCaptcha = True
if (recaptcha_challenge_field <> "" or recaptcha_response_field <> "") then
server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
newCaptcha = False
end if
%>
<html>
<body>
<% if server_response <> "" or newCaptcha then %>
<% if newCaptcha = False then %>
<<< Giriş Hatalı .....
<% end if %>
'Önemli : kontrol yapabilmesi için action sayfası aynı sayfa olmalı.
<form action="deneme.asp" method="post">
<%=recaptcha_challenge_writer()%>
</form>
<% else %>
<<< Giriş Başarılı .....
<%end if%>
</body>
</html> - 19-08-2010, 13:06:01Üyeliği durduruldu
bunu bi test sayfasında denedim dostum çalıştı çok teşekkür ederim ama giriş diğer kullanıcı adı ve şifreyi test ettiğim form kontrol.asp diye bir sayfaya götürüyor girilen veriyi. Kontrol.asp'yi login.asp nin içine taşıyım dimi?denom adlı üyeden alıntı: mesajı görüntüle