1
votes

My Session is not working Properly. My session set code like:

$data=array('username'=>$this->input->post('txtname'),
                            'password'=>$this->input->post('txtpass')
                        );  
$this->session->set_userdata($data);

When i unset the session like:

$arr=array('username'=>'','password'=>'');
$this->session->unset_userdata($arr);

i am getting the array value null but when i clicked on logout then it shows login page but when i clicked on back button it displays last page information(Username).

1

1 Answers

1
votes

Your session almost destroy

you need to redirect when you destroy your session and you need flash data.

For example.

$this->session->set_flashdata("success", $strMessage);
redirect("account/register");

And add this code on your index.php file

   header("Cache-Control: no-store, no-cache, must-revalidate");

Note that have to read flash data in your login panel $this->session->flashdata('success');