Welcome Guest, Not a member yet? Register   Sign In
callback from model
#13

[eluser]tinawina[/eluser]
Got it. This is a very cool script. Thanks Smith for sharing! Here's my final callback function in the MY_Validation.hp library in case this can help someone else:

Code:
class MY_Validation extends CI_Validation {

    function MY_Validation()
    {
        parent::CI_Validation();
        $this->CI =& get_instance(); // had to add this line so that the CI's database and validation could run. Coolio!
    }

    function password_check($table, $password)
    {
        $new_password = md5($password);
        $sql = "SELECT table.password, table_pending.password
        FROM table, table_pending
        WHERE table.password = '$new_password'  
        OR table_pending.password = '$new_password'";

        $in_use = $this->CI->db->query($sql);
        if ($in_use->num_rows() > 0)
        {
            $this->CI->validation->set_message('_password_check', $this->CI->config->item('reg_form_password_check'));
            return false;
        }
        else
        {
            return true;
        }
    }
}


Messages In This Thread
callback from model - by El Forum - 10-11-2007, 07:16 AM
callback from model - by El Forum - 10-11-2007, 12:18 PM
callback from model - by El Forum - 10-11-2007, 03:30 PM
callback from model - by El Forum - 10-11-2007, 03:48 PM
callback from model - by El Forum - 10-11-2007, 03:56 PM
callback from model - by El Forum - 10-11-2007, 04:04 PM
callback from model - by El Forum - 10-11-2007, 04:11 PM
callback from model - by El Forum - 10-11-2007, 04:11 PM
callback from model - by El Forum - 10-11-2007, 04:23 PM
callback from model - by El Forum - 10-11-2007, 04:57 PM
callback from model - by El Forum - 10-11-2007, 05:18 PM
callback from model - by El Forum - 10-11-2007, 05:51 PM
callback from model - by El Forum - 10-11-2007, 08:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB