为什么我的PHP reCAPTCHA只在Chrome和Safari上显示? [英] Why does my PHP reCAPTCHA only display on Chrome and Safari?

查看:1092
本文介绍了为什么我的PHP reCAPTCHA只在Chrome和Safari上显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我公司的网站上使用PHP reCAPTCHA。我基本上只是按照这篇教程 https://developers.google.com/recaptcha/docs/php

I'm using the PHP reCAPTCHA on my company's website. I basically just followed this tutorial https://developers.google.com/recaptcha/docs/php which is pretty straightforward. Anyway, everything displays and submits fine on Chrome and Safari, but on IE10 and Firefox the reCAPTCHA box simply doesn't show up client-side. I somewhat diverge from the tutorial in the way that I don't have a separate verification page, but I still don't see how this would affect the image displaying on various browsers. Any suggestions?

<?php
    $page = "visit";
    include 'layout/topnav.php';  
?> 

<script language="JavaScript">
function formValidate() {
    if (document.data.Comments.value == "") { alert("Please include a quick question"); return false; }
    else if (document.data.Email.value == "") { alert("Please include your email."); return false; }
    else return true;
}
</script>

<?php
$Added = False;
if (isset($_POST['submit1'])){

  require_once('recaptchalib.php');
  $privatekey = "xxxxx";
  $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

    echo "Your CAPTCHA response was not accepted. Please try again. See the Help button to the right of the entry field to learn more.";
    $Email=$_POST['Email'];
    $Comments=$_POST['Comments'];
    $Added = False;
  } 

  else {
    // Your code here to handle a successful verification

    /* Add to Database */

    $Email = '';
    $Comments = '';
    $Added = True;
   }

  }

  if(!$Added)
  {
  ?>


<html>
<head>
<body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
<form method="post" action="quick_question.php" name="data" onsubmit="return formValidate()">     
<b>Your Quick Question:<font color="red">*</font></b><br />
        <textarea wrap="hard" name="Comments" rows="5" cols="55" id="question" class="inputBox" ><? echo $Comments?></textarea>

        <table cellpadding="0">
            <tr>
                <td width="40%" valign="top"><b>Your E-mail:<font color="red">*</font></b></td>
                </tr>
                <tr>
                <td><input type="text" name="Email" size="10" id="email" class="inputBox" value="<? echo $Email?>"/></td>
            </tr>

        <tr><td>
        <b>CAPTCHA Verification:</b><font color="red">*</font>
        </td></tr>

        <tr><td>
        <?php
            require_once('recaptchalib.php');
            $publickey = "yyyy"; // you got this from the signup page
            echo recaptcha_get_html($publickey);
        ?>
        </td></tr>

        <tr><td id="submit">
        <input type="submit" name="submit1" />
        </td></tr>

        </table>
    </form>

</body>
</html>
<?php
}
?>


推荐答案

Google Chrome喜欢自动更正错误的HTML语法。确保您的recaptcha_get_html()函数返回正确的HTML代码。什么是recaptcha_get_html函数?

Google Chrome likes to auto correct bad HTML syntax. Make sure your recaptcha_get_html() function returns proper HTML code. What is the recaptcha_get_html function?

源代码是否包含任何reCaptcha内容,还是完全缺失?

Does the source code contain any reCaptcha stuff, or is it entirely missing?

你有一个网页的例子吗?

Do you have an example of the web page somewhere live?

对不起,这是标记为答案,我不能评论的帖子吗?

Sorry this is marked as an answer, I can not comment on posts still?

这篇关于为什么我的PHP reCAPTCHA只在Chrome和Safari上显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆