Welcome Guest, Not a member yet? Register   Sign In
HELP Building Captcha Auth. into stock Validation.php

Hello.. second post here Smile

I've successfully implemented the captcha_pi.php generator into a form on my website, but I don't understand how to set up the validation.

According to the plug-in captcha_pi.php this is the check to see if the correct characters have been entered;
// First, delete old captchas
    $expiration = time()-7200; // Two hour limit
    $this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);        

    // Then see if a captcha exists:
    $sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";
    $binds = array($_POST['captcha'], $this->input->ip_address(), $expiration);
    $query = $this->db->query($sql, $binds);
    $row = $query->row();

    if ($row->count == 0)
        echo "You must submit the word that appears in the image";

I'd like to make this check available in Validation.php just as the 'required' or 'valid_email' functions are. My inexperience with PHP is somewhat of a limiting factor at this point - I haven't the slightest idea how to do this.

Any pointers would be greatly appreciated!

Also, keys are successfully being generated into the database. And captcha images are being made.

Theme © iAndrew 2016 - Forum software by © MyBB