• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.