Welcome Guest, Not a member yet? Register   Sign In
Session overwriting Session of another system
#1

[eluser]soprabaixar1[/eluser]
I have two systems I use CodeIgniter, but when I log into one it overwrites the data in the other session.

I thought it could be config "sess_cookie_name", then changed one of them and did the test again, but it still fails.


Code:
$this->session->sess_destroy();

$data = array(
    'sess_cookie_name'      => 'session_system_1',
    'id_user'               => $query->id_user,
    'email'                 => $query->email,
    'name'                  => $query->name,
    'group'                 => $query->group,
    'logged_in'             => TRUE
   );

$this->session->set_userdata($data);
#2

[eluser]soprabaixar1[/eluser]
Found a solution. Instead of using the code below:
Code:
$data = array(
      'sess_cookie_name'      => 'session_system_1', // remove
      ...
);

Use it at the beginning:
Code:
$this->config->set_item('sess_cookie_name', 'session_system_1');
#3

[eluser]soprabaixar1[/eluser]
I was wrong, I did the wrong test ... the error persists.
#4

[eluser]soprabaixar1[/eluser]
The two projects use CodeIgniter and are sharing the session. I do not want to share the session.

http://ellislab.com/codeigniter/user-gui...sions.html
#5

[eluser]soprabaixar1[/eluser]
Anybody?
#6

[eluser]Samus[/eluser]
why not just change the session cookie name per application?

You can do that in application/config/config.php

Code:
$config['sess_cookie_name']  = 'ci_session'; // change this to something else
$config['sess_expiration']  = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$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;
#7

[eluser]soprabaixar1[/eluser]
Thanks, it worked.

I do not understand why I can change some config session doing this:

Code:
$this->session->sess_expiration = 10800; // 3h
$this->config->set_item('sess_expiration', 10800); // 3h


But when I try to do the same for "sess_cookie_name" does not work.
#8

[eluser]Samus[/eluser]
[quote author="soprabaixar1" date="1334354056"]Thanks, it worked.

I do not understand why I can change some config session doing this:

Code:
$this->session->sess_expiration = 10800; // 3h
$this->config->set_item('sess_expiration', 10800); // 3h


But when I try to do the same for "sess_cookie_name" does not work.[/quote]
Well I just changed my
$config['log_threshold'] = 3;

to display informational messages only and I noticed that the session class is initialized before the controller class. So that may be where your problem lies

Quote:DEBUG - 2012-04-13 21:59:07 --> Config Class Initialized
DEBUG - 2012-04-13 21:59:07 --> Hooks Class Initialized
DEBUG - 2012-04-13 21:59:07 --> Utf8 Class Initialized
DEBUG - 2012-04-13 21:59:07 --> UTF-8 Support Enabled
DEBUG - 2012-04-13 21:59:07 --> URI Class Initialized
DEBUG - 2012-04-13 21:59:07 --> Router Class Initialized
DEBUG - 2012-04-13 21:59:07 --> No URI present. Default controller set.
DEBUG - 2012-04-13 21:59:07 --> Output Class Initialized
DEBUG - 2012-04-13 21:59:07 --> Security Class Initialized
DEBUG - 2012-04-13 21:59:07 --> Input Class Initialized
DEBUG - 2012-04-13 21:59:08 --> XSS Filtering completed
DEBUG - 2012-04-13 21:59:08 --> Global POST and COOKIE data sanitized
DEBUG - 2012-04-13 21:59:08 --> Language Class Initialized
DEBUG - 2012-04-13 21:59:08 --> Loader Class Initialized
DEBUG - 2012-04-13 21:59:08 --> Config file loaded: application/config/eap.php
DEBUG - 2012-04-13 21:59:08 --> Helper loaded: url_helper
DEBUG - 2012-04-13 21:59:08 --> Helper loaded: form_helper
DEBUG - 2012-04-13 21:59:08 --> Helper loaded: html_helper
DEBUG - 2012-04-13 21:59:08 --> Helper loaded: inflector_helper
DEBUG - 2012-04-13 21:59:08 --> Database Driver Class Initialized
ERROR - 2012-04-13 21:59:08 --&gt; Severity: Warning --&gt; mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: MySQL server has gone away C:\wamp\www\EndAProblem\system\database\drivers\mysql\mysql_driver.php 91
DEBUG - 2012-04-13 21:59:08 --&gt; Session Class Initialized

DEBUG - 2012-04-13 21:59:08 --&gt; Helper loaded: string_helper
DEBUG - 2012-04-13 21:59:08 --&gt; Encrypt Class Initialized
DEBUG - 2012-04-13 21:59:08 --&gt; Session routines successfully run
DEBUG - 2012-04-13 21:59:08 --&gt; Form Validation Class Initialized
DEBUG - 2012-04-13 21:59:08 --&gt; Model Class Initialized
DEBUG - 2012-04-13 21:59:08 --&gt; Model Class Initialized
DEBUG - 2012-04-13 21:59:08 --&gt; Model Class Initialized
DEBUG - 2012-04-13 21:59:08 --&gt; Controller Class Initialized




Theme © iAndrew 2016 - Forum software by © MyBB