Support » How-To and Troubleshooting » Little Antispam function

Little Antispam function

  • Today I have many commentspam. The spambot used ascii in the author field. I think it would be important to control if it use in that field and when its true the comment shouldn’t insert into the database. What would you say?

    // Insert to stop spambots which use ASCII
    if(ereg("&#", $author)) die( "Stop spamming my Blog!" );

    The spambot used that: &# 111;nl&# 105;n&# 101; pok&# 101;r Normally its whitout a space between # and the number.

    I have make a little check for that, and if &# in the field I stop with a die().
    I insert it in funtions-post.php at line 456 before
    if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )

    What do you think about a check like that?

    I hope that you understand my english. 😐

    – bjoern

Viewing 7 replies - 1 through 7 (of 7 total)
  • There are legitimate uses of numeric entities, so I think the above code is a bit too strong. There was some code in the CVS (comments-functions.php?) that treated encoded *low* ASCII as a spam signature. Higher entities are left alone, as they should be.

    Moderator James Huff


    Agreed. I know quite a few legitimate users (myself included) who enter their email addresses as ASCII, in order to avoid the email-harvesting bots.

    My little function looks only in the author field not in the email. Its against the spambots which write there nicknames in ascii. ;( And the emailadress isn’t shown, or not?

    And I think its works. No spam since I have added it.

    bjoern, you are right. Sorry I didn’t look more closely.

    This works great, thank you!

    so this piece of code will cause the comment to never be posted at all? just… “die”?

    Yes it will cause. But I think in the latest nightly built I have tested(23.01.2005) there is a function in there which convert that ascii letters into “normal”.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Little Antispam function’ is closed to new replies.
Skip to toolbar