Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multiple session drivers of the same type
  • Hi guys, I'm setting up an admin area and a public area on my app. I need to keep the sessions separate, and I'd prefer to use a db table for each. I realize I can use a combination of a regular session and a cookie session here, but I was curious if there's a way to have multiple session drivers of the same type going at once. In addition, I need to have different expire times for each of the above. Member logins can be permanent, but admin logins should expire after 10 minutes of being idle. Is there any way I can set this per-driver, or am I going to be forced to use the Cookie class to keep track of admin logins?
  • Yes, you can, but you need to pass a custom configuration:
    $secondsession = \Session::factory( array (
                'driver' => 'db',
                'db' => array (
                    'cookie_name' => 'secondsessionid',
                    'table' => 'secondtable'
                ),
                'expiration_time' => 86400,
            )
        );
    
    It will be merged with the configuration in the config/session.php file, so you only have to specify the values that are different from the default. And you can override any config value.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion