3
good evening everyone,
I am using the codeigniter and native Session of php $_SESSION, it so happens that I can only use Session when I install a login controller that redirects to another page, but if I want to use the information of that Session on another page I can’t, says there is no such thing. I have already broken my head Ki I have tried everything a little but I can not continue in my application without first solving this question, I would like help from the staff who knows a little more. thank you all!
controller (this part works well and the admin view gets it easy to Session the problem eh if I want to use the information of this Session in other views informs q does not exist)
public function check_login()
{
$login = $this->input->post('login');
$pass = md5(md5(md5($this->input->post('pass'))));
$user = $this->login_model->checkLogin($login, $pass);
if(!$user)
{
$data['msg_erro'] = "Login ou senha inválido.";
$this->load->view('index', $data);
}
else{
if($user->cod_user == 1)
{
$_SESSION['ci_session'] = $user->name;
$this->load->view('admin');
}
else if($user->cod_user == 2)
{
$_SESSION['vendedor'] = $user->name;
$this->load->view('vendedor');
}
}
}
Even if you won’t specifically use any of her methods, press the Session Library.
– ShutUpMagda