티스토리 뷰
서비스 가입 및 메뉴얼 http://code.google.com/intl/ko-KR/apis/recaptcha/
reCaptcha.lib.asp
<%
recaptcha_public_key = "" ' your public key
recaptcha_private_key = "" ' your private key
recaptcha_challenge_field = Request("recaptcha_challenge_field")
recaptcha_response_field = Request("recaptcha_response_field")
' returns the HTML for the widget
function recaptcha_challenge_writer()
recaptcha_challenge_writer = _
"" & _
"" & _
""
end function
' returns "" if correct, otherwise it returns the error response
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
'They answered correctly
recaptcha_confirm = ""
else
'They answered incorrectly
recaptcha_confirm = ResponseString(1)
end if
end function
server_response = ""
newCaptcha = True
'// recaptcha 사용자 입력값 있으면 검사
if (recaptcha_challenge_field <> "" Or recaptcha_response_field <> "") then
server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
newCaptcha = False
end if
%>
form.asp
update.asp
<%
'// reCaptcha 사용중인데 입력이 없다면
If newCaptcha Then
Response.Write("<script> alert('인증코드를 입력해주세요.'); history.go(-1); </script>")
Response.End
End If
'// reCaptcha 오류 응답이 있다면
If server_response <> "" Then
Response.Write("<script> alert('인증코드가 틀렸습니다. 다시 입력해주세요.'); history.go(-1); </script>")
Response.End
End If
%>
Correct!
'웹프로그래밍 > ASP Classic' 카테고리의 다른 글
| Classic ASP euc-kr 페이지에서 jQuery Ajax 한글 깨짐 해결 (1) | 2011.08.25 |
|---|---|
| Classic ASP에서 XML 파싱 이후 역정렬 목록 뽑기 (0) | 2011.08.25 |
| vbCr, vbLf, vbCrLf, vbNewLine, chr(13), chr(10) (0) | 2011.07.05 |
| Classic ASP로 네이트 Open API 커뮤니케이션 (0) | 2011.06.30 |
| [Classic ASP] 변수 형식 알기 (0) | 2010.12.27 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- IE
- iphone
- JQuery
- PHP
- Prototype
- git
- mssql
- API
- Linux
- nodejs
- classic asp
- ASP
- javascript
- Debug
- Wordpress
- Android
- iis
- JSON
- IOS
- nginx
- 안드로이드
- CSS
- sencha touch
- Mac
- Docker
- macos
- 워드프레스
- centos
- laravel
- 한글
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
글 보관함