Page 1 of 1

Managing session of 'mydomain2.com' from 'mydomain1.com'

Posted: Thu Dec 14, 2006 5:39 am
by guarriman
Hi.

Working with PHP 4, I want to manage sessions for users visiting 'mydomain2.com' by using a PHP script within 'mydomain1.com' (They both are in the same web server)

I find some problems, cause 'mydomain1.com' script doesn't identify user visiting 'mydomain2.com'. I tried to use
-------
php_value session.cookie_domain "mydomain1.com"
------
within 'mydomain2.com' Apache configuration, but it doesn't work (I suppose it doesn't anything to do with cookies, right?).

Any suggestion is appreciated. Thank you very much.

Posted: Thu Dec 14, 2006 7:42 am
by Trenchant
This isn't the forum for questions about code.

Posted: Thu Dec 14, 2006 7:50 am
by DaveTheAve
Web Dummy is right, this is NOT the correct form to post your question; none-the-less, I will answer your question.

Save your session data to a database NOT via cookies and draw your session information that way.

Although their are many ways to go about this, the CLEANEST but larger way, I think would be three databases: one for mydomainone.com, one for mydomaintwo.com, and one for your session data. The next step is to create, or obtain a pre-made, class that will handle your session data and store it in a database and extract it. Of course for your system to know what session to use your would need to use a cookie, although, PHP's default session handler does the same thing; just make sure you run the session ID from the cookie into a database sanitizer first.