Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder Andy92's Avatar
    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?

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

  • #3
    Regular Coder Andy92's Avatar
    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.

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

  • #5
    Regular Coder Andy92's Avatar
    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?

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

  • #7
    Regular Coder Andy92's Avatar
    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.

  • #8
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Share!

  • #9
    Regular Coder Andy92's Avatar
    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!

  • #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?

  • #11
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    That sounds like a kludge.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •