I am using the database session driver in Kohana v2. To make sessions persistent, Kohana creates a token cookie. This cookie uses the cookie configuration I suppose.
When I set a session like this:
$this->session->set('UserID', $user->UserID);
The session variable UserID is availble even when the browser is closed. Nice.
The cookie uses this config setting:
$config['domain'] = '.mydomain.com';
How can I set the domain when I set the session variable? Every user has it own sub-domain, so it is a dynamic value.
You could figure out what subdomain you’re on right now in
index.phpbefore the bootstrapping process, and then include that variable in the cookie config file. Something like (untested):Then in cookie config: