首页 > wordpress > 防垃圾评论最简单方法

防垃圾评论最简单方法

2010年4月7日 eric 发表评论 阅读评论

        博客刚搭建好没几天,就开始有人在我的博客里发垃圾评论,每天都会有 500多条,很恶心,在后台删也删不完,就google了一下,没想到很多人都会有同样的遭遇,看到一篇文章,利用简单算法来验证,看了效果不错,这样能有效的防止,垃圾评论。因为不需要用插件吗,利于博客的访问速度很快。

首先在修改博客根目录的wp-comments-post.php

在代码

elseif ( !is_email($comment_author_email))
                wp_die( __('Error: please enter a valid email address.') );
}

下添加:

if (!$user->ID) {
        $aaa = trim($_POST[aaa]);
        $bbb = trim($_POST[bbb]);
        $subab = trim($_POST[subab]);
        if ((($aaa + $bbb)!= $subab) || empty($subab)) {
                wp_die(__('Error:Please enter the correct results of the math problems.'));
        }
}

因为我用的 inove模板所以进入wp-content/themes/inove/ 修改comments.php

找到:

 <a href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Subscribe to comments feed', 'inove'); ?></a>

<div class="submitbutton">

在下面添加:

<?php if (!$user_ID) : ?>
<?php $aaa=rand(0,5); $bbb=rand(3,9); ?><?php echo $aaa; ?>+<?php echo $bbb; ?>=
<input type="text" name="subab" id="subab" size="2" tabindex="5" style="width:20px" />
<?php if ($req) _e('(required)', 'inove'); ?>
<input name="aaa" value="<?php echo $aaa; ?>" type="hidden" />
<input name="bbb" value="<?php echo $bbb; ?>" type="hidden" />
<?php endif; ?>

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/108.html

  1. 2010年8月20日14:49 | #1

    测试下

  2. test
    2013年7月8日11:39 | #2

    test

  3. 2018年4月4日00:21 | #3

    We didn’t discover results for: water remedy
    providers.

  4. 2018年4月7日03:18 | #4

    casino games
    online casino
    real money casino
    casino online
    online slots

  5. 2018年4月7日08:57 | #5

    casino games
    real money casino
    casino games
    online slots
    real money casino

  6. 2018年4月10日16:56 | #6

    can you buy online canada http://drugstore-usa.science/ uk sale.

  7. 2018年4月11日23:03 | #7

    Online usa cheap http://drugstore-usa.science buy pills online.

  8. 2018年4月12日13:07 | #8

    hey there and tһank you for your information –
    I havе defіnitely picked uρ anytһing new fгom rіght hеre.
    I did hoԝever expertise ѕeveral technical issues սsing this web site, sincе
    I experienced tо reload the site a lot of times ρrevious tⲟ I couⅼⅾ get it to load properly.
    Ӏ hɑd been wondering if your hosting is OK?
    Not that I’m complaining, Ьut sluggish loading instances tіmеs will very frequently affect your placement
    in google аnd couⅼԁ damage your һigh-quality score іf ads and marketing with Adwords.
    Ꮃell I’m adding thіѕ RSS to myy email аnd can look out fⲟr much more of
    your respective fascinating content. Ensure tһat
    y᧐u update thiѕ agaіn ѕoon.

  9. 2018年4月12日14:36 | #9

    cheapest price http://online-medications.men/ price in usa.

  10. 2018年4月12日16:32 | #10

    Rinse with clear water and permit to dry totally.

  11. 2018年4月13日18:30 | #11

    Load the sander with 30-forty grit sandpaper.

  12. 2018年4月14日03:52 | #12

    Now, you know the way to wash black mildew in toilet.

  13. 2018年4月15日01:40 | #13

    Criminal record check richmond bc, http://background-check-services-for-employers.science/ free background checks criminal records pa.

  14. 2018年4月15日14:04 | #14

    Load the sander with 30-forty grit sandpaper.

  15. 2018年4月15日17:53 | #15

    Travis county tx criminal court records, http://background-check-renter.science/ harrison county jail inmate search.

  16. 2018年4月16日00:33 | #16

    We didn’t find results for: HVAC restore.

  17. 2018年4月16日15:47 | #17

    A finished basement is a great addition to any house.

  18. 2018年4月17日00:48 | #18

    Polished concrete flooring have few disadvantages.

  19. 2018年4月20日02:11 | #19

    $30.00 off any Service Call with repairs.

  20. 2018年4月20日23:58 | #20

    Good blog post. I absolutelly love this website.
    Keeep it up!

  21. 2018年4月21日02:19 | #21

    They’re also known as moveable steam cleaner.

  22. 2018年4月21日09:18 | #22

    Jeny is a recognized skilled on black mildew remove.

  23. 2018年4月22日15:33 | #23

    Mildew spores won’t survive in dry climates.

  24. 2018年4月23日03:51 | #24

    Methods to choose an air duct cleaning firm?

  25. 2018年4月24日05:06 | #25

    I doo nott evfen understand how I sropped up here, bbut I believed thi
    posdt used to be good. I don’t knlw who you might be buut definitely youu are goinng too a famous blogger when you aren’t
    already. Cheers!

  26. 2018年4月25日08:38 | #26

    split cialis pills ortho evra patch
    [url=http://cialisbdrx.com/#]generic cialis online[/url]
    order cialis online
    cheap cialis

订阅评论
1+8= (必填)