title: Kohana 3.2 - Session database
body: <p>i use kohana 3.2 and i have problem with session database, everytime i use Session::Instance() in my site i get a new database record for it. also the sessions doesn't work at all  even i set a new value to it </p>
  
  <p>in login page </p>
  
  <pre><code>public function action_index()
  {
      if ( Session::instance()-&gt;get('logged'))
          $this-&gt;request-&gt;redirect('home');
  
  
      $this-&gt;response-&gt;body(View::factory('pages/login'));
  
  }
  </code></pre>
  
  <p>in auth function </p>
  
  <pre><code>public function action_authenticate()
  {
      $username = $this-&gt;request-&gt;post('username');
      $password = $this-&gt;request-&gt;post('password');
  
      $user = ORM::factory('user');
      $data = $user-&gt;user_login($username, $password);
  
      if ( $data == $username){
  
  
           Session::instance()-&gt;set('logged', true);
  
           $this-&gt;request-&gt;redirect('home');
  
      }
      else
      {
          echo "incorrect username or password";
      }
  </code></pre>
  
  <p>and in Home page i just redirect back to login if logged isn't set</p>
  
  <pre><code> function action_index(){
  
      if (  ! Session::instance()-&gt;get('logged'))
          $this-&gt;request-&gt;redirect('login');
  
  
     $this-&gt;template-&gt;header = View::factory('pages/header')-&gt;render();
     $this-&gt;template-&gt;footer = view::factory('pages/footer')-&gt;render();
     $data['sidebar'] = View::factory('pages/sidebar')-&gt;render();
     $this-&gt;template-&gt;content = View::factory('pages/home',$data);
  
  }
  </code></pre>
  
  <p>in bootstrap.php i added  Session::$default = 'database'; so it uses database by default.
  if i remove database mode it works just fine and if its there i get all time 3 database records since i call Session::instance  3 times ? </p>
  
  <p>i am new to kohana. but not new to php.</p>
  
  <p>thanks for help</p>