首页 > 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. 2018年9月11日17:50 | #1

    You really make it appear so easy along with your presentation but I to find this topic
    to be actually something which I believe I’d by no means understand.
    It sort of feels too complicated and very vast for
    me. I am taking a look forward for your next publish, I’ll attempt to get the dangle of
    it!

  2. 2018年9月13日05:20 | #2

    Wonderful beat ! I wish to apprentice at the same time as you amend your website, how could i subscribe for a blog site?
    The account helped me a acceptable deal. I were tiny bit familiar of this
    your broadcast offered bright transparent idea

  3. 2018年9月13日19:03 | #3

    Hi to every single one, it’s in fact a nice for me to visit this website,
    it includes precious Information.

  4. 2018年9月16日01:49 | #4

    I am in fact thankful to the owner of this web page who has shared this enormous paragraph at here.

  5. 2018年9月17日08:11 | #5

    It’s hard to come by experienced people in this particular topic, however, you seem like you know what you’re
    talking about! Thanks

  6. 2018年9月17日16:06 | #6

    Heya just wanted to give you a brief heads up and let you know a few of
    the pictures aren’t loading properly. I’m not sure why but I think its a linking issue.
    I’ve tried it in two different browsers and both show the same outcome.

  7. 2018年9月20日03:06 | #7

    Hi! I’ve been reading your site for a while now and finally
    got the courage to go ahead and give you a shout out from Atascocita Tx!
    Just wanted to mention keep up the fantastic work!

  8. 2018年9月20日15:57 | #8
  9. 2018年9月21日23:07 | #9

    Today, while I was at work, my cousin stole my iPad and tested
    to see if it can survive a twenty five foot drop,
    just so she can be a youtube sensation. My iPad is now broken and she
    has 83 views. I know this is completely off topic but I had to
    share it with someone!

  10. 2018年9月24日21:24 | #10

    Keep this going please, great job!

  11. 2018年10月1日05:52 | #11

    When someone writes an article he/she keeps the thought
    of a user in his/her mind that how a user can be aware of it.
    Thus that’s why this post is outstdanding. Thanks!

  12. 2018年10月1日11:49 | #12

    Hello everyone, it’s my first pay a visit at this website, and paragraph is truly
    fruitful in support of me, keep up posting such content.

  13. 2018年10月1日16:17 | #13

    Howdy! I understand this is sort of off-topic however I needed to ask.
    Does managing a well-established blog such as yours require a large amount of work?
    I’m brand new to writing a blog however I do write in my
    journal daily. I’d like to start a blog so I can easily share my experience and
    thoughts online. Please let me know if you have any kind of suggestions or tips
    for brand new aspiring blog owners. Thankyou!

  14. 2018年10月2日00:34 | #14

    Asking questions are truly fastidious thing if you are not understanding something fully, but this
    paragraph presents nice understanding yet.

  15. 2018年10月2日05:51 | #15

    Hello! I just wanted to ask if you ever have any issues with hackers?

    My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no
    data backup. Do you have any methods to protect against hackers?

  16. 2018年10月2日12:44 | #16

    Yes! Finally something about minecraft.

  17. 2018年10月3日04:33 | #17
  18. 2018年10月3日13:18 | #18
  19. 2018年10月4日10:28 | #19

    I studied in a couple of colleges for appearing.

  20. 2018年10月5日22:37 | #20
  21. 2018年10月6日02:03 | #21

    I every time spent my half an hour to read this weblog’s articles or
    reviews all the time along with a mug of coffee.

  22. 2018年10月6日07:32 | #22
  23. 2018年10月7日02:27 | #23

    It’s in fact very complex in this active life to listen news on Television, thus I just use internet for that purpose, and take the hottest information.

  24. 2018年10月7日06:52 | #24

    I pay a visit everyday some websites and blogs to read articles or reviews, except this web
    site presents quality based writing.

  25. 2018年10月8日13:35 | #25

    I’m not sure exactly why but this blog is loading incredibly slow for me.
    Is anyone else having this problem or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  26. 2018年10月10日04:10 | #26

    Having read this I believed it was really informative. I appreciate
    you finding the time and effort to put this informative article together.
    I once again find myself spending a significant
    amount of time both reading and posting comments.

    But so what, it was still worthwhile!

  27. 2018年10月10日11:28 | #27

    I don’t even know the way I stopped up here, but I thought this submit
    was good. I do not recognise who you are however definitely you’re going to a famous blogger
    if you aren’t already. Cheers!

  28. 2018年10月10日13:06 | #28

    Hello all, here every person is sharing these knowledge, thus it’s good to read this webpage, and I used to pay a
    quick visit this weblog daily.

  29. 2018年10月11日19:06 | #29

    Hello, i think that i noticed you visited my blog thus i came
    to go back the favor?.I am attempting to find issues to improve
    my web site!I assume its ok to use a few of your concepts!!

  30. 2018年10月16日20:07 | #30

    Woah! I’m really enjoying the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s very difficult
    to get that “perfect balance” between usability and visual appeal.

    I must say you’ve done a superb job with this. Also, the blog loads extremely quick
    for me on Safari. Exceptional Blog!

  31. 2018年10月16日22:54 | #31

    Fantastic beat ! I wish to apprentice whilst you amend your site, how
    can i subscribe for a weblog web site? The account aided me a acceptable deal.
    I were tiny bit familiar of this your broadcast
    provided brilliant transparent concept

  32. 2018年10月18日16:14 | #32

    I don’t know whether it’s just me or if everyone else experiencing problems with your site.
    It appears like some of the written text in your posts are running off the screen. Can someone else please comment and
    let me know if this is happening to them as well?
    This might be a issue with my web browser because I’ve had
    this happen before. Thanks

  33. 2018年10月18日20:52 | #33

    Excellent post. I was checking continuously this blog
    and I am impressed! Very helpful info specially
    the last part :) I care for such information much.

    I was seeking this particular info for a long time. Thank you and best of
    luck.

  34. 2018年10月18日23:20 | #34

    That is what Methodology Actors name ‘sense memory’.

  35. 2018年10月19日23:10 | #35

    se venta cialis generico en mexico
    cialis vs viagra vs levitra
    onhoxte@mail.ru
    cialis viagra levitra online

  36. 2018年11月10日08:26 | #36

    What’s up mates, nice piece of writing and nice arguments commented here, I am
    genuinely enjoying by these.

  37. 2018年11月11日02:12 | #37

    whoah this weblog is wonderful i love reading your posts.
    Keep up the great work! You understand, lots of persons are hunting around for this information, you
    can help them greatly.

  38. 2018年11月12日13:35 | #38

    I just like the helpful info you supply on your articles.
    I will bookmark your blog and check once more here
    regularly. I am somewhat certain I will be told lots of new stuff right here!
    Best of luck for the next!

  39. 2018年11月14日05:57 | #39

    Pretty nice post. I just stumbled upon your blog and wished to
    say that I’ve truly enjoyed browsing your blog posts.
    In any case I’ll be subscribing to your feed and I hope you write again soon!

  40. 2018年11月16日00:39 | #40

    It is appropriate time to make some plans for the future and it’s time to be happy.
    I have read this submit and if I may I desire to recommend you some
    attention-grabbing issues or tips. Maybe you could write next articles regarding this article.

    I wish to learn more issues approximately it!

  41. 2018年11月17日09:28 | #41

    Sling tv coupons and promo codes for november 2018
    Hello, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam feedback?
    If so how do you reduce it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any help is very much appreciated.
    Sling tv coupons and promo codes for november 2018

  42. 2018年11月18日22:08 | #42

    I read this article completely about the difference of
    hottest and preceding technologies, it’s awesome article.

  43. 2018年11月19日10:56 | #43

    Excellent post. I used to be checking continuously
    this blog and I’m inspired! Extremely useful information specially the closing part :
    ) I care for such information a lot. I was seeking
    this particular info for a very lengthy time. Thank you and good luck.

  44. 2018年11月19日14:53 | #44

    It’s enormous that you are getting thoughts from this post as well as from our dialogue made at this
    time.

  45. 2018年11月21日22:54 | #45

    Your style is very unique compared to other folks I have read stuff from.

    Thank you for posting when you have the opportunity, Guess I will just book mark this site.

  46. 2018年11月23日03:04 | #46

    Very good post. I will be going through some of these issues as well..

  47. 2018年12月2日01:04 | #47

    The correct recommendation can prevent money and time.

  48. 2018年12月3日16:46 | #48

    Maihoob
    http://cialisonbrx.com – cialis
    how much is viagra at walmart cialis generic

  49. 2018年12月5日16:54 | #49

    I all the time used to read paragraph in news papers but now as I am a user of net so from now I am using net
    for content, thanks to web.

评论分页
1 ... 4 5 6 108
订阅评论
5+4= (必填)