Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的reCAPTCHA实现是否有缺陷?_Php_Html_Recaptcha - Fatal编程技术网

Php 我的reCAPTCHA实现是否有缺陷?

Php 我的reCAPTCHA实现是否有缺陷?,php,html,recaptcha,Php,Html,Recaptcha,我有这个网站,从本周开始,我一直收到垃圾邮件帖子和评论。我把电视放在上面是为了让你欣赏。它们总是只出现在第一页上。我对reCAPTCHA的实现是否有缺陷,或者是否被合法地击败。放松点,这不是一个完美编码的网站。整个网站只有一个页面 这是我的邮政编码: # are we submitting the page? if (isset($_POST['submit'])) { $resp = recaptcha_check_answer ($privatekey,

我有这个网站,从本周开始,我一直收到垃圾邮件帖子和评论。我把电视放在上面是为了让你欣赏。它们总是只出现在第一页上。我对reCAPTCHA的实现是否有缺陷,或者是否被合法地击败。放松点,这不是一个完美编码的网站。整个网站只有一个页面

这是我的邮政编码:

# are we submitting the page?
if (isset($_POST['submit'])) {
  $resp = recaptcha_check_answer ($privatekey,
                                  $_SERVER["REMOTE_ADDR"],
                                  $_POST["recaptcha_challenge_field"],
                                  $_POST["recaptcha_response_field"]);

  if ($resp->is_valid) {

                //validate data kind of!
                if($_POST['title'] == "")
                {
                    $_POST['title'] = "The Canucks Suck";
                }

                if($_POST['comment'] == "")
                {
                    $_POST['comment'] = "New Jersey is the best, we all know it!";
                }

                if($_POST['name'] == "")
                {
                    $_POST['name'] = "Anonymous";
                }
                if($_POST['location'] == "")
                {
                    $_POST['location'] = "Too embarrassed to disclose it.";
                }
                $ip = getUserIpAddr();

                $_POST['location'] = $_POST['location'] +"--"+ $ip;
                //convert line breaks to <br /> from /n etc
                $br_comment = nl2br($_POST['comment']);

                //add info to database
                $obj->insert_values("INSERT INTO posts (post_id, title, comment, name, time, location) VALUES (NULL, '$_POST[title]', '$br_comment', '$_POST[name]', NULL, '$_POST[location]')");

                header( 'Location: index.php?success=1' ) ;

                //for debugging
                echo "<h2 style=\"color:#00FF00; background:black; padding:2px;\">SUCCESSFULLY ADDED, THANKS!</h2>";

                } else {
                    echo "<span style=\"color:red;\">Sorry cannot add comment because you've failed to provide correct captcha! Try again...</span><br />";
                }
            }
            echo recaptcha_get_html($publickey, $error);
?>
#我们正在提交页面吗?
如果(isset($_POST['submit'])){
$resp=repatcha\u check\u response($privatekey,
$\u服务器[“远程地址”],
$\u POST[“重演挑战场”],
$(POST[“recaptcha_response_field”]);
如果($resp->有效){
//验证数据类型!
如果($_POST['title']==“”)
{
$\u POST['title']=“Canucks吮吸”;
}
如果($_POST['comment']==“”)
{
$\u POST['comment']=“新泽西是最好的,我们都知道!”;
}
如果($_POST['name']==“”)
{
$\u POST['name']=“匿名”;
}
如果($_POST['location']==“”)
{
$\u POST['location']=“不好意思透露。”;
}
$ip=getUserIpAddr();
$\u POST['location']=$\u POST['location']+“--”+$ip;
//将换行符从/n等转换为
$br_comment=nl2br($_POST['comment']); //向数据库添加信息 $obj->insert_值(“插入到帖子(帖子id、标题、注释、名称、时间、位置)值(NULL,$$u帖子[title],$br_注释',$$u帖子[name],$u帖子[location],$NULL,$$u帖子[location])”; 标题('Location:index.php?success=1'); //用于调试 echo“已成功添加,谢谢!”; }否则{ echo“抱歉,无法添加评论,因为您未能提供正确的验证码!请重试…”; } } echo recaptcha_get_html($publickey,$error); ?>
reCapctcha可能会受到以下服务的影响,例如,印度基本上有很多“验证码解算器”。一些垃圾邮件机器人可能会使用它


只是让你知道。

我想这确实回答了我的问题。因此,即使是其他形式的验证码也将毫无用处。我想保持我的网站公开,以便任何人都可以张贴。有更好的解决办法吗?我应该自己做几个问题吗?你的建议是什么?与reCAPTCHA讨论无关,如果此代码是你网站上的代码,那么你很有可能会被SQL注入和/或XSS攻击。你说得对。。。我从来没有注意到。然而,我不认为这是我垃圾邮件的来源。您还必须首先在reCAPTACHA上取得成功。我正在将这个旧站点切换到RubyonRails。