View Full Version : Sharing session data on different sites?
04-03-2007, 10:24 PM
I have multiple websites, and i want to enable it so that when a user goes to any of the websites, and logges in, it will automatically share the same session id throughout all my sites so that they are logged in on all sites.
Is there a way to do this?
04-03-2007, 10:27 PM
If the websites are all on the same server AND are using or have access to the same database (specifically the users/sessions table) then yes.
Well for subdomains I know its possible as I do it. I have never done it with different domain names. You may run into a problem with assigning the session/cookie to the domain. Not sure.
04-03-2007, 10:47 PM
Yes, the websites are on the same server, and yes they both have access to the same database.
04-03-2007, 11:09 PM
Then have a gander at this page:
You will have to do your own saving/loading from the database, but that way you can hook it up to several sites.
04-03-2007, 11:15 PM
But when it says...
function open($save_path, $session_name)
Does the $save_path variable refer to opening it from a mysql database? Or a users cache?
And what will been to be put for the session name?
04-03-2007, 11:27 PM
You will have to figure that out from the page I linked you too.
Since I haven't ever set this up.
Why not try a test page. Echo out each function and its variables. See what it is giving you.
04-05-2007, 12:50 AM
Ok, got it all sorted now. :)
04-05-2007, 12:52 AM
04-05-2007, 10:30 PM
Basically, when a person logges in, it sends a form to another website of mine with the session data, then diverts back. So they are logged in on both sites!
04-05-2007, 10:33 PM
Yea but is it sharing the same session id?
04-05-2007, 11:11 PM
That sounds like a kludge.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.