我敢肯定,這很簡單,但我不能看到它:)不能使用reCAPTCHA工作(甚至顯示!)
我想一個驗證碼加入到代碼爲現有網站有一點接觸形式。
我有谷歌的密鑰(當然在例子中被審查過),但我甚至無法得到它顯示CAPTCHA,更不用說測試過濾是否正常。
我已經添加了驗證碼代碼插入到頁面:
的index.html:
form name="f1" method="post" action="mail2.php" onsubmit="return verify();">
<p><label>Your Name <span>(*)</span></label><input type="text" name="name" /></p>
<p><label>Your Email</label><input type="text" name="email" /></p>
<p><label>Your Phone No: <span>(*)</span></label><input type="text" name="phone" /></p>
<p><label>Other messages</label><textarea name="messages" rows="" cols=""></textarea> </p>
<?php
require_once('recaptchalib.php');
$publickey = "6LdrxxxxxxxxxxxxxxJr"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<p style="padding-right:36px; float:right;"><input name="" type="image" src="images/submit_btn.png" /></p>
</form>
而在mail2.php
<?php
require_once('recaptchalib.php');
$privatekey = "6LxxxxxxxxxxxxxxxxxxqZYiH";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
require_once 'mailer/class.phpmailer.php';
$mail = new PHPMailer();
----followed by the standard PHPMailer content----
索引頁只是顯示爲標準沒有顯示CAPTCHA部分,試圖發送電子郵件導致失敗並顯示一些PHP代碼。
我真的很感激,如果有人比我的頭腦更大吃&呼吸reCAPTCHA可以投下他們的眼睛,笑&指向我出錯的地方。 :)
希望受到教育,而不僅僅是一個修復。我的技能在於內容而不是編碼。
(我如何在編輯器中插入一個代碼塊?肯定沒有通過4位分別縮進每一行?)
非常感謝。
這並沒有真正提供問題的答案。如果您有新的問題,請點擊[問問題](http://stackoverflow.com/questions/ask)按鈕。您可以[添加賞金](http://stackoverflow.com/help/privileges/set-bounties)在足夠[聲譽](http:// stackoverflow。COM /幫助/什麼聲譽)。 – honk 2014-12-01 20:17:57
歡迎來到StackOverflow。我可能會建議添加一個鏈接到你使用的任何資源。這樣可以幫助您將原始海報發送給一些更有幫助和完整的信息,因爲您提到不確定您答案的某個方面。 – philtune 2014-12-01 20:18:06
我的回答是否回答了他的一些問題......他問道:「無法讓ReCAPTCHA正常工作(甚至不能顯示)」我提供的解決方案可以讓reCAPTCHA顯示。 我真的很失望,你「鳴」,你「philtune」。鄧肯裏德在幾個月前提出了一個問題,並沒有得到任何人的迴應。然後,我會一起去嘗試幫助,我會得到什麼回報?... 因此,您不是爲了回答問題而貢獻任何有用或有價值的東西,而只是嘲笑我。非常感謝。 – Brook 2014-12-01 20:33:06