Welcome Guest, Not a member yet? Register   Sign In
Two CI in one site - messing each other's session variables


I have two parts of a website both written with separate CI installations (dont ask why!).
The problem is that they are "erasing" each other's session variables when you jump from one to another.

Can you tell me if there is something I can write in the config or do something else to prevent from such crossing in the sessions.

THanks in advance

[eluser]Tom Schlick[/eluser]
in the config file change the cookie prefix. that should take care of it.


Thanks a lot. That really solved the problem.

Thanks again.


[eluser]louis w[/eluser]
Even better yet you should set the cookie_path in the config. By default this will be "/". If you have two sites on the same domain a cookie path of / will make the cookies available to both. Normally you set a cookie path to the sub directory your site is in and the cookies will only be available to scripts in that directory. This is built in cookie security.

I dynamically populate this with the directory my index.php resides in.

// Index.php:
define('SITEPATH', (dirname($_SERVER['SCRIPT_NAME']) == '/') ? '/' : dirname($_SERVER['SCRIPT_NAME']).'/');

// config.php
$config['cookie_path']        = SITEPATH;

Having a variable containing the working directory of my site (SITEPATH) comes in very handy.

Thanks man,

I will keep that in mind for the future.

THat will be really handy indeed.


Theme © iAndrew 2016 - Forum software by © MyBB