Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthoramnesia
    • CommentTimeDec 3rd 2007
     
    Is there anybody who has a captcha script and knows how to implement it into plogger.
    This damn spammer keeps spamming me daily and it's become very annoying.
    •  
      CommentAuthorkent
    • CommentTimeDec 3rd 2007 edited
     
    i have captcha.. but my plogger install is so heavily modified .. i dont know if i can help you

    in plog-comment.php .. but you have to modify it to suit your website

    if ((md5($_POST['captcha_code']) != $_SESSION['captcha_code']) || !$_POST['captcha_code'])
    {
    $_SESSION["comment_post_error"] = "CAPTCHA check failed!";
    unset($_SESSION['captcha_code']);
    header("Location: " . $redirect);
    exit;
    }

    add a field in theme/comments.php

    <p>
    <label for="captcha_code">Security code:</label><br />
    <input type="text" name="captcha_code" id="captcha_code" title="Type the code in the image" value="" /><br />
    <img src="<?php echo BLAH_URL; ?>/scripts/image_verification.php" alt="kod" width="60" height="25" />
    </p>

    and.. of course .. the captcha script :) dont know if its mine or a modified from the net .. ill check and get back to you soon
    •  
      CommentAuthorkent
    • CommentTimeDec 3rd 2007 edited
     
    <?php
    session_start();

    $alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

    $rand = substr(str_shuffle($alphanum), 0, 5);

    // Choose one of five background images
    $bgNum = rand(1, 5);

    // Create them yourself ;)
    $image = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT']."/images/image_verification_background_$bgNum.jpg");

    $textColor = imagecolorallocate ($image, 0, 0, 0);

    imagestring ($image, 5, 8, 5, $rand, $textColor);

    $_SESSION['captcha_code'] = md5($rand);

    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    header('Content-type: image/jpeg');

    imagejpeg($image);
    imagedestroy($image);
    ?>

    It could maybe be done better .. i run this for now .. maybe recode this later
    • CommentAuthoramnesia
    • CommentTimeDec 4th 2007
     
    excellent! Will try it out now.
    • CommentAuthoramnesia
    • CommentTimeDec 4th 2007
     
    just noticed that this was already in there

    // If the captcha is required, check it here
    if ($_SESSION['require_captcha'] == true) {
    if (($_POST['captcha'] != $_SESSION['captcha']) || !$_POST['captcha']) {
    $_SESSION["comment_post_error"] = "CAPTCHA check failed!";
    header("Location: $redirect");
    exit;
    }
    }

    Does this mean that plogger has captcha already built in?


    Also I'm not to sure which line to insert your scripts?
    •  
      CommentAuthorkent
    • CommentTimeDec 4th 2007
     
    I dont know..

    My second post is "image_verification.php"
    • CommentAuthoramnesia
    • CommentTimeDec 4th 2007
     
    I added

    <p>
    <img src="'.$config["gallery_url"].'plog-captcha.php" alt="CAPTCHA Image" id="captcha-image" />
    </p>
    <p>
    <input type="text" name="captcha" id="captcha" value="" size="28" tabindex="3" />
    <label for="url">What does this say?</label>
    </p>

    to the comments section with the call function and it's working now :D
    •  
      CommentAuthorkent
    • CommentTimeDec 4th 2007
     
    ok .. good :)
    • CommentAuthorMikeC
    • CommentTimeFeb 21st 2009
     
    Hi Guys, I know this is old, but it seems to have worked for you both.

    I followed what you have both said and I can't get it to work.

    The image shows up and everything, but regardless of wether a code is entered, and regardless of if it is correct of not, the comment still goes for moderation.
    If moderation is disabled, the comment is posted as normal.

    Help!
    • CommentAuthorGalerio
    • CommentTimeFeb 22nd 2009 edited
     
    The same thing happens to me with Plogger 3.0b. Tha Captcha shows up, but whatever I enter or not a word the comment is posted.
    What should I do?
    • CommentAuthorGalerio
    • CommentTimeFeb 22nd 2009 edited
     
    SOVED:
    in the file plog-functions.php you must fine the code (at line 1218):

    $_SESSION['require_captcha'] = false;

    and delete it and paste this:

    $_SESSION['require_captcha'] = true;

    Then in "comments.php" of your theme paste this before your "Post Comment" button:

    <p>
    <img src="'.$config["gallery_url"].'plog-captcha.php" alt="CAPTCHA Image" id="captcha-image" />
    </p>
    <p>
    <input type="text" name="captcha" id="captcha" value="" size="28" tabindex="3" />
    <label for="url">What does this say?</label>
    </p>
    • CommentAuthorMikeC
    • CommentTimeFeb 22nd 2009
     
    Excellent thank you!

    I will try it tomorrow and let you know if it works or not!
    • CommentAuthorMikeC
    • CommentTimeFeb 24th 2009
     
    Galerio: I have just tried this, there are actually two instances of 'require_captcha' I have set both to true, and copied your code exactly.
    Is there anything else that you have done because I am obviously doing something wrong, it is still doing the same as it was.

    Thanks for your help so far!
    • CommentAuthorray_trace
    • CommentTimeSep 22nd 2009
     
    Thanks Galerio! I got captcha working, woot! Although I had to do a minor modification, different path and had to wrap $config["gallery_url"] in php/echo (not sure if because I'm running V3beta or not)

    <p>
    <img src="<?php echo $config["gallery_url"]?>plog-includes/plog-captcha.php" alt="CAPTCHA Image" id="captcha-image" />
    </p>
    <p>
    <input type="text" name="captcha" id="captcha" value="" size="28" tabindex="3" />
    <label for="url">What does this say?</label>
    </p>