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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
guarriman
Forum Commoner
Posts: 44
Joined: Thu Nov 03, 2005 4:11 am

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

Post 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.
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

This isn't the forum for questions about code.
User avatar
DaveTheAve
Forum Contributor
Posts: 385
Joined: Tue Oct 03, 2006 2:25 pm
Location: 127.0.0.1
Contact:

Post 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.
Post Reply