Jump to content

Sessions across domains


ryanh_106

Recommended Posts

Hey,

I want people to be able to log into my forum (which is stored on a sub-domain) and then switch over to the main website and still be recognised. However as sessions are only active while you remain on the same domain, I cant get this to work. Surely there must be some way to set for which domains the session is active. Any ideas? Any suggestions are much appreciated

Ryan
Link to comment
https://forums.phpfreaks.com/topic/33531-sessions-across-domains/
Share on other sites

The easiest way is to save your session data into a database allong with the session id and an ip. Then, pass the session id via the url to the second domain, from here, use the id to pull the infomation back out of the database and into a new session specific to that domain.
Hmmm, I thought it was going to involve something like that, kinda defies the point of redirecting to the forum login page at all I may as well just work out exactly what the forum does to log someone in, and duplicate it on my site.

But then, when they move over to the forums, they wont be logged in...... damnit this is going to take more thought than i can manage so early in the day!

Thanks for the advise guys

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.