Strict Standards: Redefining already defined constructor for class wpdb in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/wp-db.php on line 52

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/cache.php on line 389

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/classes.php on line 678

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/theme.php on line 507

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/wp-db.php:52) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-content/plugins/contactforms/cforms.php on line 61

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/wp-db.php:52) in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-content/plugins/contactforms/cforms.php on line 61

Deprecated: Function split() is deprecated in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-content/themes/jr_articles/header.php on line 3
J.R. Photoblog - Articles & Tutorials » Blog Archive » Anti-spam trick for Pixelpost
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/kses.php on line 446

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/kses.php on line 510

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/kses.php on line 511

Anti-spam trick for Pixelpost


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

Version Française ici

I think I’m not the only one who have been bombarded by spambots with my pixelpost, I used to have up to 200 per day!

So I looked for a simple and efficient solution, and I think I found one because since I set up it half and a year ago, spams are just a bad souvenir…

Here is the idea:

Most of the spammers don’t go on you website (or perhaps just one time), usually they use automated systems which post malicious comments directly to the script that record them. Conclusion: they never use the comments form and so, they never click on the “Add comment” button.

The trick is to check if the button was “physically” clicked or not before recording.

There are two steps to set it up, you need to:

  • Modify the form so that it is able to detect if the button was clicked or not.
  • Modify the recording script so that it receives the result of the form and decide to record or not.

1. Edit your form:

First, what you need to do is to find where your comments form is located.
Most of the time it is in your template directory in image_template.html or in comment_template.html.

  • Here is the change to do with the “simple” template of pixelpost 1.5:
    The Pixelpost 1.5 “simple” template uses a popup, so the comments form is located in comment_template.html

    ORIGINAL CODE (must be replaced by the modified code below):

    MODIFIED CODE:

  • For pixelpost 1.6 :
    This is exactly the same thing as for 1.5 version except that, for the “horizon” template, the form to edit is located in image_template.html.

1. Edit the recording script:

  • For Pixelpost 1.5 :
    Open index.php and go to line 933 located at the beginning of the section “SAVE COMMENT”

    ORIGINAL CODE (must be replaced by the modified code below):

    MODIFIED CODE:

    Thus, comments will be recorded only if the value “ahuman” is received, so, if the button was clicked.

    Do the same thing at line 1025 located at the beginning of the section “EMAIL NOTE ON COMMENTS”. Thus, comments will be sent by email only if the value “ahuman” is received, so, if the button was clicked.

  • For Pixelpost 1.6 :
    This is exactly the same thing as for 1.5 version except that the 2 lines to edit are located in includes/functions_comments.php at line 15 and 225.

Voilà !
Of course it doesn’t stop “manual spams”, but this kinds of spams are quite unusual. If spams suddenly start again, it is because they understood the trick and they are injecting the expected value “ahuman” with their scripts, so in this case, try to change the variable name “you_are” and its ideal value “ahuman” by something else.

5 Comments »


  1. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

    Hello Julien,

    This is a great patch, thanks. I’m using it for two days now and no more spam! To make it XHTML compliant I had to modify the “onClick” attribute in “onclick”.

    Best regards,
    Piet

    Julien : Thanks for your observation Piet, I corrected the code.

    Comment by Piet Osefius — October 7, 2007 @ 2:04 pm


  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

    That’s very cleaver ! I do a little bit of javascript myself and I never thought of such a simple and elegant solution ! I will try it at once ;)
    About the “manual spam” I read once that it might soon become cost-effective for the spammers to hire people of poor countries in order to bypass protections against spambots such as captcha… or yours. If it turns true, we bloggers we’ll be in deep trouble :(

    Julien : Ouch yes you are right, if spammers become humans we would need moderation everywhere.

    Comment by XtoF — October 13, 2007 @ 12:05 pm


  3. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

    AH!!! Finallement! :D

    Et moi qui cherchait la solution si loin, sur le net, alors qu’elle etait si “proche”!

    Un gros merci! Tu viens de me sauver un 15 minutes de SPAM par jour!

    Merci Julien! J’t'en dois une!

    Alain

    p.s. Instructions d’installation pas valides pour pixelpost 1.7.

    Julien : Exact pour la V1.7 de pixelpost, mais je vais attendre la release finale avant celà. Il est d’ailleurs même probable qu’il ne soit plus nécessaire de hacker pixelpost vu le nouveau système de plugin … à étudier.

    Comment by Alain Franco — November 18, 2007 @ 10:30 pm


  4. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

    Not necessarly but first solution in my mind is quite awfull :
    we’ll need a per IP/country automatic moderation :/
    For example a comment from UK could be considered as ok, one from Angola submitted to moderation with an option to bann a country. yep that’s not ideal but …
    Another method could be to check how much comment from a ‘poor’ country, if it occur from a real ‘usefull’ user it’s probably not twice a day ? It could be combined with IP range ban, … endless battle isn’t it :)

    If a country doesn’t have nor respect legislation to punish spammers what other choice ?
    Oh! still the content check, spamming without adress nor brand is quite useless (but that’s a definition for spam anyway, useless and dumb).

    Julien : 8O

    Comment by Seb — December 4, 2007 @ 1:40 am


  5. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/15/d175376943/htdocs/BLOG_JR_WORDPRESS/wp-includes/formatting.php on line 74

    Best solution regarding spam, in my experience, is www.akismet.com. This was originally meant for wordpress, but has been used in pixelpost. I think there’s an add-on of some sort unless the feature is built right into pixelpost.

    Julien : Hum, Askimet wasn’t the best solution for me, some of the spams were stopped but not 100%, but I admit my solution has a drawback : you must imperatively click on the “submit comment button” but this is not really a problem with pixelpost. For those who are interested in the Askimet solution, read this

    Comment by Tin — December 28, 2007 @ 5:35 am

Leave a comment

Please don't leave a comment to say 'thank you' but only if you have something interesting to add or to ask, ;) .


» Close
E-mail It