1
I have a system where a session is created for the user after their login, the problem is that each access I make to the site a new session is created and the recorded data is deleted, I set the session as autoload and the settings are:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'nomequalquer';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
this is the login code:
$user = $this->user_model->doLogin($_POST);
if($user != false){
$this->session->set_userdata(array('logged' => true, 'user' => $user));
$_SESSION['sess_id'] = session_id();
echo json_encode(array('1', $_SESSION));
}else ...
Send session data to record them on Chrome console, redirect is done here:
...
function(data, status, jqXHR){
if(status == 'success'){
...
var result = JSON.decode(data);
//debugging
console.log(result[1]);
//redirecionamento
windows.location.replace = <?php echo "'" . base_url(array('admin/usuarios')) . "'"; ?>;
...
}
}
...
On the page some/page
I put a button that accesses the following code on the server:
$_SESSION[session_id()] = 'hello!';
var_dump($_SESSION);
you can see that the session id changes at any time and the data entered in the login no longer exists. What would be the reason for this?
pq vc mixes the default php session with the CI session?
– rray
because the documentation says I can do so...
– Paulo Marcio