Enjoy an ad free experience by logging in. Not a member yet?
Register .
04-03-2007, 09:24 PM
PM User |
#1
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Sharing session data on different sites?
Hi there,
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, 09:27 PM
PM User |
#2
Regular Coder
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
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, 09:47 PM
PM User |
#3
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Yes, the websites are on the same server, and yes they both have access to the same database.
04-03-2007, 10:09 PM
PM User |
#4
Senior Coder
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
Then have a gander at this page:
http://us.php.net/manual/en/function...ve-handler.php
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, 10:15 PM
PM User |
#5
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok,
But when it says...
PHP Code:
function open ( $save_path , $session_name ) { global $sess_save_path ;
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, 10:27 PM
PM User |
#6
Senior Coder
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
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-04-2007, 11:50 PM
PM User |
#7
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Ok, got it all sorted now.
04-04-2007, 11:52 PM
PM User |
#8
Regular Coder
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
Share!
04-05-2007, 09:30 PM
PM User |
#9
Regular Coder
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
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, 09:33 PM
PM User |
#10
Regular Coder
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
Yea but is it sharing the same session id?
04-05-2007, 10:11 PM
PM User |
#11
Senior Coder
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
That sounds like a kludge.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 12:53 AM .
Advertisement
Log in to turn off these ads.