少女祈禱中...
Loading...
图片加载过慢?试试 从源站加载资源 X

ccloli

与垃圾评论的斗争(续)

首先感谢琥珀酱的帮助~~~> <虽然这篇文章并没有用到《[野生技术]已审核的评论不显示验证码(beta)》和《日常Ⅱ(3)》的方法QUQ……【喂

自从使用了验证码后,垃圾评论确实少了许多。但问题也就来了,例如在手机上使用WPtouch插件就无法正常发表评论。于是便在其中增加了新的参数:


  1. // pixiv-custom/functions.php
  2. …………
  3. function pixiv_cmn_checkbox() {
  4. $label = __(‘当有人回复时向我发送电子邮件’,’pixiv’);
  5.         echo ‘<div id=”comment_notify_checkbox”><input name=”is_pc” value=”true” hidden/><label for=”are_you_ad_robot”>验证码:ccloli</label><input type=”text” name=”are_you_ad_robot” id=”are_you_ad_robot” style=”width:50px;background:rgba(255,255,255,.5);display:inline;padding-right:10px”><input type=”checkbox” name=”comment_mail_notify” id=”comment_mail_notify” value=”comment_mail_notify” checked=”checked”/><label for=”comment_mail_notify”>’.$label.'</label></div>’;
  6. }
  7. …………
  1. // wp-comments-post.php
  2. …………
  3. if ( !$user->ID && trim($_POST[‘is_pc’])==’true’  ) {
  4.         $aaarb = trim($_POST[‘are_you_ad_robot’]);
  5.         if ( $aaarb != ‘ccloli’ )
  6.         wp_die( __(‘<strong>错误</strong>: 请输入正确的验证码.’) );
  7. }
  8. if ( ” == $comment_content )
  9. …………

问题解决了,而且期间也没有垃圾评论。但是每次都输验证码也会很麻烦嘛,所以尝试直接在验证码框上加value=”ccloli”。问题在于第二天垃圾评论就回来了,不得已只能改回来。

难道只能这样吗?所以通过目前的信息思考一下机器人发表垃圾评论的步骤。个人猜测应该是调用浏览器获取页面内容,随机生成用户名、邮箱、User Agent等并生成广告评论。之所以认为是“调用浏览器获取页面内容”而不是直接用post方法提交给wp-comments-post.php,是因为后台页面都存在User Agent且都是电脑端,在添加验证码后也没有垃圾评论(如果直接用post方法提交给wp-comments-post.php可以绕过验证码……因为“&& trim($_POST[‘is_pc’])==’true’ ”……OTL)。

看来验证码是必要的,那么能不能自动填写验证码呢?思考了一下,做到了这个效果:

  1. // pixiv-custom/functions.php
  2. …………
  3. function pixiv_cmn_checkbox() {
  4. $label = __(‘当有人回复时向我发送电子邮件’,’pixiv’);
  5.         echo ‘<div id=”comment_notify_checkbox”><input name=”is_pc” value=”true” hidden/><label for=”are_you_ad_robot” style=”display:none”>验证码:ccloli</label><input type=”text” name=”are_you_ad_robot” id=”are_you_ad_robot” style=”width:50px;background:rgba(255,255,255,.5);display:/*inline*/none;padding-right:10px”><script>document.getElementById(“submit”).onclick=function(event){document.getElementById(“are_you_ad_robot”).value=”ccloli”}</script><input type=”checkbox” name=”comment_mail_notify” id=”comment_mail_notify” value=”comment_mail_notify” checked=”checked”/><label for=”comment_mail_notify”>’.$label.'</label></div>’;
  6. }
  7. …………

这样,当用户点击【提交评论】时会自动添加验证码。事实证明效果不错,垃圾评论也没有出现……看来robot估计是用submit()什么的提交的……/ \以上……

  1. 馒头饭madfan说道:

    我来试试验证码

    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP
  2. Jak Wings说道:

    -_- 难怪我无法在同一页面连续回复……验证码框都被隐藏了……麻烦补上

    Internet Explorer 2.0 Internet Explorer 2.0 Windows 3.1 Windows 3.1
    1. 864907600cc说道:

      现在应该没有问题了吧……/ \

      Google Chrome 27.0.1426.0 Google Chrome 27.0.1426.0 Windows XP Windows XP
      1. Jak Wings说道:

        应该是在你修改之后发生的事,就是回复新年那篇的时候,现在再试试……@_@

        Internet Explorer 2.0 Internet Explorer 2.0 Windows 3.1 Windows 3.1
      2. Jak Wings说道:

        嗯,麻烦在点击发表后过一段时间再次自动填写验证码。= =

        Internet Explorer 2.0 Internet Explorer 2.0 Windows 3.1 Windows 3.1
        1. Jak Wings说道:

          第二次生成回复表单的时候没有自动填写验证码的脚本~

          Internet Explorer 2.0 Internet Explorer 2.0 Windows 3.1 Windows 3.1
    2. 独星说道:

      我比較好奇你的系統和瀏覽器居然還能訪問本站……

      Google Chrome 25.0.1364.97 Google Chrome 25.0.1364.97 Windows 7 x64 Edition Windows 7 x64 Edition
      1. Jak Wings说道:

        @_@ 我是不存在君

        Google Chrome 99.0.9999.0 Google Chrome 99.0.9999.0 GNU/Linux x64 GNU/Linux x64
      2. 千与琥珀说道:

        其实直接改掉ua就ok啦

        Internet Explorer 1.0 Internet Explorer 1.0 Windows NT Windows NT
        1. Jak Wings说道:

          IE1.0的图标竟然这么好看……不科学……O_O

          Google Chrome 27.0.1430.0 Google Chrome 27.0.1430.0 GNU/Linux x64 GNU/Linux x64
          1. 864907600cc说道:

            0_0……

            Google Chrome 24.0.1312.57 Google Chrome 24.0.1312.57 Windows 7 x64 Edition Windows 7 x64 Edition
            1. Jak Wings说道:

              = = 难道你是自动回复君…… 另外怎么现在设置简单样式后,刷新了还是透明样式 -_-?

              Google Chrome 27.0.1430.0 Google Chrome 27.0.1430.0 GNU/Linux x64 GNU/Linux x64
              1. 864907600cc说道:

                改回来了,前几天玩玩强制背景什么的/ \
                这主题坑爆了/ \自动去除JavaScript标签
                另外现在站点不稳定,有时会被重置或者找不到dns服务器

                Google Chrome 24.0.1312.57 Google Chrome 24.0.1312.57 Windows 7 x64 Edition Windows 7 x64 Edition
      3. 864907600cc说道:

        修改userAgent而已

        Google Chrome 1024.2048.4096.8192 Google Chrome 1024.2048.4096.8192 Windows 8 x64 Edition Windows 8 x64 Edition
  3. 千与琥珀说道:

    其实介个也不错,不过人肉或用脚本的spam貌似可以突破
    其实我那边的第二个方法你也可以加上的说,免得后台留言ip都是127.x.x.x,赶脚不太爽

    Google Chrome 25.0.1364.97 Google Chrome 25.0.1364.97 Windows 7 Windows 7
    1. 864907600cc说道:

      反正现在没事了/ \先不管这么高深的东西

      Google Chrome 27.0.1426.0 Google Chrome 27.0.1426.0 Windows XP Windows XP
      1. 千与琥珀说道:

        其实挺简单的说,就是绕过代理取得首级ip

        Safari 4.0.5 Safari 4.0.5 iPhone iOS 4.0 iPhone iOS 4.0
        1. 864907600cc说道:


          貌似可以了/ \不过刚刚又收到一条Traceback垃圾评论……还真是/ \

          Google Chrome 24.0.1312.57 Google Chrome 24.0.1312.57 Windows 7 x64 Edition Windows 7 x64 Edition
  4. 三十岁说道:

    垃圾评论啊,我那多年不见一条.木哈哈哈哈

    Google Chrome 25.0.1364.97 Google Chrome 25.0.1364.97 Windows XP Windows XP