It Beginneth

Sunday, January 9th, 2005

In the past day or two I’ve received five comment spams, and have manually deleted them all using the clunky Wordpress interface. In the long run having to do this every time would drive me mad, so it’s time to implement some kind of anti-spam solution. Browsing around at the various complicated options, it appears that this is one situation where "rolling-yer-own" is the way to go… Just the way I like it.

Stage One is now in place, and for all I know it may turn out to be all that is required to stop [automated] spams. It’s pretty basic, involving an invisible custom field in the posting form.

It will be interesting to see if it works.

feed

3 Comments

  1. Rich S says:

    Not trying to rip your code off, just a question from someone with the same issue. How do you generate the comment_request_ID, comment_post_ID and redirect values, and how do you check against them in your template?

    Fascinating blog, million miles from what I do.

  2. mark says:

    To be honest I don’t know whether the code is really doing me much good [i
    am still deleting about 3 spams a day, which for all intents and purposes
    seem to be manually entered… perhaps javascript will stop these?] The
    original spams i was getting seem to have stopped, but that may be due to
    the fact that I renamed my wp-comments-post.php file

    FWIW, those values are generated and checked thusly…

    Generating the form:

    comment_request_ID = (time() ^ 0×55555555)
    comment_post_ID = $id
    redirect_to = $_SERVER[”REQUEST_URI”]

    Validating the fields:

    $comment_request_ID = $comment_request_ID ^ 0×55555555;
    if ($comment_request_ID > time() || $comment_request_ID < time() - 3600)
    die(”Error!”);

  3. Rich S says:

    makes sense, thank you! I think the most practical suggestion is renaming the comments file. cheers!

Leave a Comment

Name

Name

URL

URL