Welcome Guest, Not a member yet? Register   Sign In
CI session database, lot of data
#1

[eluser]broadband[/eluser]
I have some temporary data which I decided to save in flashdata (for the next request).

There will be lot of data, more than 4 kB (which is maximum browser cookie size), so I decided to use
database.

Code:
$config['sess_cookie_name']     = 'session';
$config['sess_expiration']        = 7200;
$config['sess_expire_on_close']   = true;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = true;
$config['sess_table_name']      = 'ci_session';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']  = false;
$config['sess_time_to_update']   = 300;

This way the cookie on the client side, does not contain value, only session_id, expire, .... not user_data.

For testing purposes I tried to save a lot of session user_data in database. Second method test2() does not show anything. Has anybody experienced the same?

Code:
public function test()
  {
    $string = "test";
    for($i = 0; $i < 10;$i++) $string .= $string;

    $this->load->library('session');
    $this->session->set_userdata(array('test' => $string));
  }



Code:
public function test2()
  {
    $this->session->userdata('test');
  }

If I try with php native sessions:

Code:
public function test()
  {
    $string = "test";
    for($i = 0; $i < 10;$i++) $string .= $string;

    session_start();
    $_SESSION['test'] = $string;
  }


Code:
public function test2()
  {
    session_start();
    echo $_SESSION['test'];
  }



Messages In This Thread
CI session database, lot of data - by El Forum - 01-24-2012, 04:59 AM
CI session database, lot of data - by El Forum - 01-24-2012, 05:07 AM
CI session database, lot of data - by El Forum - 01-24-2012, 05:18 AM
CI session database, lot of data - by El Forum - 01-24-2012, 11:39 AM
CI session database, lot of data - by El Forum - 01-24-2012, 11:59 AM
CI session database, lot of data - by El Forum - 01-25-2012, 01:33 AM
CI session database, lot of data - by El Forum - 01-25-2012, 01:45 AM
CI session database, lot of data - by El Forum - 01-25-2012, 06:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB