2

托管代码的服务器正在运行 Coldfusion 4.5。有问题的页面是一个框架集,所以我不能直接链接到它。

就是这个页面: http: //www.palosverdes.com/calendar/,然后是右边“Admin”下的注册链接。

在允许被阻止的内容后,现在那里的代码可以按预期在 IE 上运行。这是代码:

<cfscript>
CHALLENGE_URL = "http://api.recaptcha.net";
SSL_CHALLENGE_URL = "https://api-secure.recaptcha.net";
VERIFY_URL = "http://api-verify.recaptcha.net/verify";
</cfscript>

<cfif isDefined("form.recaptcha_challenge_field") and isDefined("form.recaptcha_response_field")>

<cftry>
    <cfhttp url="#VERIFY_URL#" method="post" throwonerror="true">
        <cfhttpparam type="formfield" name="privatekey" value="6LfwVs0SAAAAAIlIJpLDvIay_d5G0RncS0VSrnV0">
        <cfhttpparam type="formfield" name="remoteip" value="#cgi.REMOTE_ADDR#">
        <cfhttpparam type="formfield" name="challenge" value="#form.recaptcha_challenge_field#">
        <cfhttpparam type="formfield" name="response" value="#form.recaptcha_response_field#">
    </cfhttp>
<cfcatch>
    <cfthrow  type="RECAPTCHA_NO_SERVICE"
        message="recaptcha: unable to contact recaptcha verification service on url '#VERIFY_URL#'">
</cfcatch>
</cftry>

<cfset aResponse = listToArray(cfhttp.fileContent, chr(10))>
<cfset form.recaptcha = aResponse[1]>
<cfset structDelete(form, "recaptcha_challenge_field")>
<cfset structDelete(form, "recaptcha_response_field")>

<cfif aResponse[1] eq "false" and aResponse[2] neq "incorrect-captcha-sol">
    <cfthrow type="RECAPTCHA_VERIFICATION_FAILURE"
        message="recaptcha: the verification service responded with error '#aResponse[2]#'. See http://recaptcha.net/apidocs/captcha/ for error meanings.">


</cfif>



<cfelse>

<cfset form.recaptcha = false>

</cfif>


<cfif isdefined("form.recaptcha") and form.recaptcha neq "false">
<cfinclude template="addorgresults.cfm">
<cfelse>

我已经使用此页面http://www.palosverdes.com/sandbox/captchatest.cfm来确定验证码本身是否正常工作,所以我的猜测是它与将验证码放入框架集中有关。有任何想法吗?

4

1 回答 1

2

它在 Firefox 中不起作用的原因:

api-secure.recaptcha.net 使用了无效的安全证书。

该证书仅对 www.google.com 有效

(错误代码:ssl_error_bad_cert_domain)

您似乎使用两组不同的代码进行测试,一组(有效)和一组无效。

坏掉的那个:

<script type="text/javascript"
   src="https://api-secure.recaptcha.net/challenge?k=6LfwVs0SAAAAAClnUJ5XD7O19d9ZdlGBFgAn8Gws">
</script>


<noscript>
   <iframe src="https://api-secure.recaptcha.net/noscript?k=6LfwVs0SAAAAAClnUJ5XD7O19d9ZdlGBFgAn8Gws"
       height="300" width="500" frameborder="0"></iframe><br>
   <textarea name="recaptcha_challenge_field" rows="3" cols="40">
   </textarea>
   <input type="hidden" name="recaptcha_response_field"
       value="manual_challenge">
</noscript>

一个有效的:

<script type="text/javascript"
 src="http://www.google.com/recaptcha/api/challenge?k=6LfwVs0SAAAAAClnUJ5XD7O19d9ZdlGBFgAn8Gws">

</script>
<noscript>
 <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfwVs0SAAAAAClnUJ5XD7O19d9ZdlGBFgAn8Gws"
     height="300" width="500" frameborder="0"></iframe><br>
 <textarea name="recaptcha_challenge_field" rows="3" cols="40">
 </textarea>
 <input type="hidden" name="recaptcha_response_field"
     value="manual_challenge">
</noscript>

我认为您需要将第一个 URL 的 URL 从api-secure.recaptcha.net更改为google.com/recaptcha/api

于 2012-07-17T20:05:35.470 回答