Sharing session data between main site and squirrelmail

View: New views
2 Messages — Rating Filter:   Alert me  

Sharing session data between main site and squirrelmail

by koinkobot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.  I have example.com, which is my own site that lets people log in, and then example.com/sqmail, which has squirrelmail.  I'd like users to be able to move between the two without having to log in again.  I am now able to move to squirrelmail and pass the login data to squirrelmail, but moving in the opposite direction is not working.

What I'd like is for a php file on the main site, eg. example.com/account.php, to be able to "peek" at squirrelmail's session data.  This is the code I have come up with:

ini_set('session.name' , 'SQMSESSID');
session_set_cookie_params ( 0, '/sqmail/' );
@session_start();

Of course, it doesn't work.  The $_SESSION variable is empty after doing this.

Does anyone have an idea of what's wrong, or how I should approach doing this?  Thanks!

Re: Sharing session data between main site and squirrelmail

by koinkobot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


After getting some sleep, I have realized that the simple solution is to change session_set_cookie_params in squirrelmail so that the cookie path is '/'.  Now I can access the squirrelmail session from my main site's code.

koinkobot wrote:
Hello.  I have example.com, which is my own site that lets people log in, and then example.com/sqmail, which has squirrelmail.  I'd like users to be able to move between the two without having to log in again.  I am now able to move to squirrelmail and pass the login data to squirrelmail, but moving in the opposite direction is not working.

What I'd like is for a php file on the main site, eg. example.com/account.php, to be able to "peek" at squirrelmail's session data.  This is the code I have come up with:

ini_set('session.name' , 'SQMSESSID');
session_set_cookie_params ( 0, '/sqmail/' );
@session_start();

Of course, it doesn't work.  The $_SESSION variable is empty after doing this.

Does anyone have an idea of what's wrong, or how I should approach doing this?  Thanks!