Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-03-2007, 09:24 PM   PM User | #1
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
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?
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 04-03-2007, 09:27 PM   PM User | #2
iLLin
Regular Coder

 
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
iLLin is an unknown quantity at this point
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.
iLLin is offline   Reply With Quote
Old 04-03-2007, 09:47 PM   PM User | #3
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Yes, the websites are on the same server, and yes they both have access to the same database.
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 04-03-2007, 10:09 PM   PM User | #4
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
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.
aedrin is offline   Reply With Quote
Old 04-03-2007, 10:15 PM   PM User | #5
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
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?
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 04-03-2007, 10:27 PM   PM User | #6
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
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.
aedrin is offline   Reply With Quote
Old 04-04-2007, 11:50 PM   PM User | #7
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
Ok, got it all sorted now.
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 04-04-2007, 11:52 PM   PM User | #8
iLLin
Regular Coder

 
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
iLLin is an unknown quantity at this point
Share!
iLLin is offline   Reply With Quote
Old 04-05-2007, 09:30 PM   PM User | #9
Andy92
Regular Coder

 
Andy92's Avatar
 
Join Date: Nov 2005
Location: Horsham, West Sussex, UK
Posts: 363
Thanks: 7
Thanked 1 Time in 1 Post
Andy92 is an unknown quantity at this point
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!
__________________
@Andy92 / Dribbble
Andy92 is offline   Reply With Quote
Old 04-05-2007, 09:33 PM   PM User | #10
iLLin
Regular Coder

 
Join Date: Oct 2005
Location: Right Here
Posts: 654
Thanks: 1
Thanked 0 Times in 0 Posts
iLLin is an unknown quantity at this point
Yea but is it sharing the same session id?
iLLin is offline   Reply With Quote
Old 04-05-2007, 10:11 PM   PM User | #11
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
That sounds like a kludge.
aedrin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 AM.


Advertisement
Log in to turn off these ads.