[eluser]Felipe Deitos[/eluser]
Thanks for all your answers dude...
I am using that Template that you teached me...
I changed the way i validate de user, because i am storing the lvl(level) of the user in the session...
I dont know if what i am doing are the best pactices, but its working...
controller:
Code:
public function validate_user()
{
$this->load->model('users_model');
$data = $this->users_model->validate();
if($data['is_logged'])
{
$this->session->set_userdata($data);
redirect($this->input->post('current_url'));
}
else
{
redirect($this->input->post('current_url'));
}
}
model:
Code:
public function validate()
{
$this->db->where('user', $this->input->post('user'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('users');
// return ($query->num_rows == 1);
if($query->num_rows == 1)
{
$data = array(
'user' => $query->row('user'),
'lvl' => $query->row('lvl'),
'is_logged' => true
);
return ($data);
}
else
{
$data = array(
'is_logged' => false
);
return ($data);
}
}
The problem is... as you can see in the controller, if the 'is_logged' = false i just redirect the user to the current_url... i want to pass and error message with it... how can i do that using the Template style that you showed me?
Thanks again for all the help!