Page 1 of 1
Sessioons and Logging in to multiple sites?
Posted: Tue Apr 22, 2003 5:54 am
by mchaggis
Hi,
I was wondering if there was a way to allow users to log into multiple sites at once using sessions.
It is just 2 urls at the moment and they are on the same server, so I have been wondering it it's possible to trick php into sharing the sessions (or session files) between the to sites?
Posted: Tue Apr 22, 2003 12:49 pm
by phpfreak
I think the best solution would be to store the usernames and session created on them in a text file and then by having your open_basedir=on(if it is in the same server but different directory) and your allow_url_fopen=on(if the url of the text file is in other protocol),you can access this file and give the user the permissions to use any directory depending on the sessions listed in the text file. then you can use the fopen function to write the session to the text files or destroy them from the text files.
Posted: Tue Apr 22, 2003 2:24 pm
by mchaggis
I think i see... but how would i know it was the right user?
I theory, it seems a quite simple idea, but in practice i need to pass a cookie that can be read by both sites that contains session id and thus the sharing of files/sessions works.
Hmmm have a few ideas....
Posted: Tue Apr 22, 2003 2:36 pm
by mchaggis
Ok, half of the problem solved...
Two option have presented... One was in one of someones posts to the PHP manual (doh!)..
For sites that share same domain:
Code: Select all
session_set_cookie_params( time()+9999999, "", ".domain.com");
Ooo I wonder what would happen if I put .com or .uk for the domain
The second is playing with the setcookie function and setting a cookie for every domain I want the session to work for