Welcome Guest, Not a member yet? Register   Sign In
validation failing - not sure why
#1

[eluser]deco10[/eluser]
I'm following this:
http://codeigniter.com/wiki/Simplelogin/

I know its failing at the validation, its not even getting to the login part.

I always tries to go to /example4/ which isn't a page, I just put it there so I can see what its doing. The password for my users is 3 characters. Its not a high security thing, just to stop outside users from seeing data we'd prefer they didn't


What am I doing wrong here?


form code
Code:
$data['loginform']['submit'] =     array(    'name'        => 'submit',
                                        'id'          => 'login',
                                        'value'       => 'Login to ');  
                                      
          $data['loginform']['user_input'] = array(    'name'        => 'login_username',
                                        'id'          => 'user_input',
                                        'value'       => $this->input->post("login_username"));
                                
          $data['loginform']['pw_input'] = array(      'name'        => 'login_password',
                                        'id'          => 'pw_input',
                                        'value'       => '');



function that does the login, loads view
Code:
function login()
{
      $this->load->helper('url');
        $this->load->library('validation');
        
        //Check incoming variables
        $rules['login_username']    = "required|min_length[4]|max_length[32]";
        $rules['login_password']    = "required|min_length[1]|max_length[32]";        

        $this->validation->set_rules($rules);

        $fields['login_username'] = 'Username';
        $fields['login_password'] = 'Password';
        
        $this->validation->set_fields($fields);
                
        if ($this->validation->run() == false) {
            /*
            //If you are using OBSession you can uncomment these lines
            $flashdata = array('error' => true, 'error_text' => $this->validation->error_string);
            $this->session->set_flashdata($flashdata);
            $this->session->set_flashdata($_POST);
            */
            redirect('/example4/');            

}else
........

}

}


Messages In This Thread
validation failing - not sure why - by El Forum - 07-03-2009, 10:22 AM
validation failing - not sure why - by El Forum - 07-03-2009, 10:58 AM
validation failing - not sure why - by El Forum - 07-03-2009, 05:35 PM
validation failing - not sure why - by El Forum - 07-03-2009, 07:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB