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
$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
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
........
}
}
