Jump to content

how to use session on 2 diff domains


pixeltrace

Recommended Posts

guys,

 

i need help. i have 2 different domains which needs to use the user account, or cookie.

let say i login to www.domain.com and then i go to www.domain-2.com.

when i go to domain-2.com if i am already logged in to domain.com i will automatically

be logged in to domain-2.com and vice -versa.

 

is this possible? if so, what will the code be and how to do it?

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/50429-how-to-use-session-on-2-diff-domains/
Share on other sites

Session data is simply data that is saved on the server's disk such that it can persist between HTTP requests.  Typically the server will set a cookie on the client (although this can also be accomplished by passing the session hash in the query string) with a hash which uniquely identifies the data saved on the server's disk.  If the two domains point to two separate servers then I don't believe this is possible at all.  If the domains do point to the same server then it becomes a matter of getting at the session ID.  The previous poster's solution should be adequate in the latter example, as cookies cannot be shared across domains.

 

Best,

 

Patrick

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.