Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.