(06-21-2015, 06:11 PM)jmsmontecillo Wrote: (06-21-2015, 04:04 PM)webdevron Wrote: I'm using session like bellow in my CI app on a domain (i.e. domain.com)-
PHP Code:
$set['x'] = $id;
$set['y'] = $name;
$set['z'] = $lavel;
$this->session->set_userdata($set);
Now I want to use these session variables on a subdomain (i.e. sub.domain.com). How to do that..? Is there any option in CI to do that?
Thank you in advance.
Hi webdevron,
I think you can do that in config.php
Look for these entries.
$config['encryption_key'] = 'encryption';
$config['sess_cookie_name'] = 'sess_cookie_name';
and make it the same to your codeigniter config.php in each of your subdomain.
That will work.
Thanks.
That's obvious (even if encryption_key is only relevant for CI2), but the important part is to set
cookie_domain to the top-level domain (e.g. domain.com), which allows all its subdomains (sub1.domain.com, sub2.domain.com, etc.) to receive the cookie.