Welcome Guest, Not a member yet? Register   Sign In
Session Problem CI2.0
#1

[eluser]Unknown[/eluser]
I use CodeIgniter and save Sessions in my DB.

The following line of code will be executed if the users try to login and the login is successfull (found his data in the db):

$this -> session -> set_userdata($account_data); /login-page

After this i redirect the user to my dashboard. The dashboard tries now to read the $account_data from the session. BUT

$this -> session -> all_userdata(); /dashboard

outputs only the standart session content from codeigniter. I check the session after the set_userdata call (above) and the array is loaded. But there is no db-entry for this session. Ok i call the all_userdata(); in the dashboard - it shows the standart content of the session AND a the data is saved in my db.

Summary:

LoginPage - Load some Accountdata and save it in a Session. I can load the Accountdata from this session. NO db-entry

Dashboard - Session contains only the standart content of codeigniters session. DB-Entry with this data exists.

Only at the beginning of the LoginPage i destroy the session.

I'm a little bit confused, it seems the session is not "transported" to the next site.

Any tips?

Edit: Test-Case
Code:
public function testSessionStart(){
           if ($this->session->userdata('key')){

           }else{
               $this->session->sess_destroy();
           }

            $this->session->set_userdata('key','12345566');
            debug($this->session->all_userdata());
            debug($this->session->userdata('session_id'));
            echo "<br><a href='".base_url()."login/testSessionEnd'>Klick me</a>";
        }

        public function testSessionEnd(){
            $this->session->set_userdata('sid','hasd12312kasdj89d');
            debug($this->session->all_userdata());
            debug($this->session->userdata('session_id'));
        }

If the Start func is called, the db never get's an entry. End func generates a new Session and save it to the db. i have no idea why




Theme © iAndrew 2016 - Forum software by © MyBB