CodeIgniter Forums
Creates a new session when reloading page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Creates a new session when reloading page (/showthread.php?tid=47514)



Creates a new session when reloading page - El Forum - 12-12-2011

[eluser]Unknown[/eluser]
Hi, I am new by this forum. thanks in advance. I have the problem with de sessions in my project. This session is regenerated each time the page loads. I am using: server XAMPP in localhost and sessions in database.

Code Controller
Code:
class usuario extends CI_Controller {
  
  function __construct() {
    parent::__construct();
  }
  
  function index(){
    
    $this->parser->parse('datos-usuario', $this->session->all_userdata());
  }
  
  
}

Config.php
Code:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

Code View
Code:
<html>
<head>
<title>DATOS USUARIO</title>
</head>
<body>

  <p>session_id: {session_id}</p>
  <p>last_activity: {last_activity}</p>

&lt;/body&gt;
&lt;/html&gt;

Examples
Quote:session_id: 18cb8654716977d4231c4ce879c7907f
last_activity: 1323700067

----

session_id: ca44e89e156d7179f1a8d8111289f147
last_activity: 1323700088