form validation help PLEASE

#15
[eluser]dadamssg[/eluser]
I THINK I FINALLY GOT IT WORKING Smile....sort of. I noticed that the callback function has to be OUTSIDE of the index function and the md5 in the rules isn't working. so i'm md5ing it in the query as well and it works...heres the working code. that still bugs me why the md5 wont work :/
Code:
<?php

class Login extends Controller {

    function Login()
    {
        parent::Controller();
        $this->load->database();
        $this->load->library('session');
        $this->load->helper(array('form', 'url'));
    }

    function index()
    {
        
        
        $this->load->library('validation');    
        $rules['username']    = "required|callback_username_check";
        $rules['password']    = "md5|required";
        
        
        $this->validation->set_rules($rules);
        
        
                if ($this->validation->run() == FALSE)
                {
                    $this->session->set_flashdata('message', 'Doesnt Match.');
                    redirect('mains');
                }
                else
                {
                    
                    $this->session->set_flashdata('message', 'It WORKED.');
                    redirect('mains');
                }
    
        
        
    
    
    }
    function username_check()
        {
            
            $user = $this->input->post('username');
            $pass = $this->input->post('password');
            $query = $this->db->query("SELECT loginName,active FROM Member WHERE loginName='$user'
                                AND password=md5('$pass')");
                if($query->num_rows() > 0)
                {
                return TRUE;
                }
                else
                {
                return FALSE;
                }
        
        }
}

?>


Messages In This Thread
form validation help PLEASE - by El Forum - 01-09-2010, 12:34 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:20 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:21 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:24 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:28 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:31 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:31 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:33 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:35 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:42 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:43 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:45 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:54 AM
form validation help PLEASE - by El Forum - 01-09-2010, 01:55 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:01 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:03 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:05 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:08 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:09 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:09 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:10 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:13 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:16 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:20 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:20 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:24 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:27 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:32 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:41 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:45 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:45 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:48 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:51 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:56 AM
form validation help PLEASE - by El Forum - 01-09-2010, 03:13 AM
form validation help PLEASE - by El Forum - 01-09-2010, 10:51 AM
form validation help PLEASE - by El Forum - 01-09-2010, 02:42 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:45 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:52 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:54 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:54 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:56 PM
form validation help PLEASE - by El Forum - 01-09-2010, 02:59 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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