• kc8esj

    (@kc8esj)


    Hi,
    I’m not sure if anyone has made this hack yet, but I got so fed up with the spam posts that I spent the few minutes to make it. The way it works is it simply uses an image on the comments page that the user has to enter to submit their comment.. I’ve used just two letters , but you can make it do as many as you would want.

    You can see how it looks here: http://richard.cernava.com/index.php?p=62#comments

    How do you do the hack???

    #1 Download wp-comments-verify.php (this is the file that generates the image) at http://richard.cernava.com/wp-comments-verify.phps

    #2 Rename it to wp-comments-verify.php and place it in the main folder with the rest of the wp files. Remeber you can edit it and modify the colors of the out put file etc!

    #3 Edit /wp-includes/functions.php and right after <?php on the next line add and save:

    function verify($input)
    {
    session_start();
    $input = trim($input);

    $code = $_SESSION["vcode"];

    $_SESSION["vcode"] = '';

    if ($code == $input && $input != '')
    return 1;
    else
    return 0;
    }

    #4 Edit ~/wp-comments-post.php goto line 85 right after

    if ( '' == $comment )
    die( __('Error: please type a comment.') );

    and add this:

    if (!verify($code))

    die( __('Error: Invalid verification code.') );

    #5 Edit ~/wp-comments.php got line 54 right after

    <code><form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    Add this and save:

    <input type="text" name="code" id="code" class="textarea" value="" size="2" tabindex="1" />
    <label for="verification"><img src="<?php echo get_settings('siteurl'); ?>/wp-comments-verify.php"><?php _e("(Enter Code)"); ?></label>

    That should fix the problems!!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Spam free forever more!’ is closed to new replies.