2012-07-17 135 views
2

承載代碼的服務器正在運行coldfusion 4.5。有問題的頁面是一個框架集,所以我無法直接鏈接到它。在FF或Chrome上不顯示recaptcha,IE在允許阻止內容後顯示

這是此頁:http://www.palosverdes.com/calendar/,然後在右側的「管理」下注冊鏈接。

那裏的代碼現在可以按照預期的方式在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確定驗證碼本身工作正常,所以我的猜測是,它是與把驗證碼的框架。有任何想法嗎?

回答

2

的原因,它不能在Firefox工作:

api-secure.recaptcha.net使用無效的安全證書。

證書只適用於www.google.com

(錯誤代碼:ssl_error_bad_cert_domain)

你似乎是使用2套不同的代碼測試一個(的作品)和不起作用的那個。該工程

<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的從api-secure.recaptcha.net第一個google.com/recaptcha/api

+0

這解決它。謝謝! – 2012-07-17 21:15:56

相關問題