[eluser]solid9[/eluser]
hi guys
I'm trying to store and display the username through variable session.
<b>storing 'username'session variable:</b>
Code:
if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
{ //if the login is successful
//store username into session
//redirect them back to the home page
$this->session->set_userdata('username', $this->input->post('identity'));
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect($this->config->item('base_url'), 'refresh');
}
<b>displaying 'username' session variable:</b>
Code:
function login()
{
//$data_user['username'] = $this->input->post('identity');
$this->data['username'] = $this->session->userdata('username');
echo 'user: '. $this->data['username'];
$this->data['header'] = $this->load->view('header', $this->data, TRUE);
$this->data['midnav'] = $this->load->view('body_m_frontpage', null, TRUE);
$this->load->view('front_page', $this->data);
}
But it won't display the username.
It's not displaying the currently login username?
What is wrong with my codes?
Thanks in advanced.