user1509885
user1509885

Reputation:

CakePHP 2.2 - two different app's and one session

I have one database - (users, administrators). I have 2 app. (application/login, backend/login).

So, when I log in at "backend" with my administrator data, I don't want to be logged in with that SAME data on "application".

How can I get two different sessions for two different applications in CakePHP under the same browser?

I want to be logged in with administrators under /backend and with user under /application.

CakePHP 2.2.0.

Thank you all. :)

Upvotes: 2

Views: 838

Answers (1)

user1390975
user1390975

Reputation: 104

Solved it. In app/Config/core.php:

Application:

Configure::write('Session', array(
        'defaults' => 'cake',
        'ini' => array(
            'session.cookie_path' => '/application',
        ),
        'cookie' => 'my_cookie',
    ));

Backend:

Configure::write('Session', array(
        'defaults' => 'cake',
        'ini' => array(
            'session.cookie_path' => '/backend',
        ),
        'cookie' => 'my_cookie_2',
    ));

Thanks anyway. :D I've learned a lot in this few hours. :D

Upvotes: 5

Related Questions