php - CodeIgniter: Limit cookies only on maindomain.tld and www.maindomain.tld -


i'm working on project on codeigniter , limit cookies on maindomain.tld , www.maindomain.tld, because have another, third, domain another.maindomain.tld has installed same application little different features. config maindomain.tld that:

$config['cookie_prefix']    = ""; $config['cookie_domain']    = "maindomain.tld"; $config['cookie_path']      = "/"; $config['cookie_secure']    = false; 

and another.maindomain.tld:

$config['cookie_prefix']    = ""; $config['cookie_domain']    = "another.maindomain.tld"; $config['cookie_path']      = "/"; $config['cookie_secure']    = false; 

cookies maindomain.tld working on another.maindomain.tld shouldn't be, because databases different , there might not same user same id.

i suggest use prefix.

http://codeigniter.fr/user_guide/helpers/cookie_helper.html

the prefix needed if need avoid name collisions other identically named cookies server.

so try this:

$config['cookie_prefix']    = "main"; $config['cookie_domain']    = "maindomain.tld"; $config['cookie_path']      = "/"; $config['cookie_secure']    = false;   $config['cookie_prefix']    = "sub"; $config['cookie_domain']    = "another.maindomain.tld"; $config['cookie_path']      = "/"; $config['cookie_secure']    = false; 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -