Page 1 of 1
How to login into a site from another one?
Posted: Fri Mar 16, 2007 11:54 am
by guarriman
Hi.
I've got 'foo1.com' where users log in by using PHP sessions. I store login and password hash into the session, and each time one user access a webpage, I check them.
But I've created 'foo2.com' and want users not to log in again on another login point, but using the 'foo1.com' login. I mean, if you are logged in 'foo1.com' you are also logged in 'foo2.com'. How to manage it? Must I create a webservice or something similar?
Thank you very much.
Posted: Fri Mar 16, 2007 12:04 pm
by mentor
for this you need to set the value for session.cookie_domain. in your login page, before initializing session put this line
ini_set ( 'session.cookie_domain', '.foo2.com' );
for more info visit
http://www.php.net/manual/en/ref.sessio ... kie-domain
Posted: Fri Mar 16, 2007 12:13 pm
by guarriman
Hi.
I forgot to mention that 'foo1.com' and 'foo2.com' are on different machines, and that the 'users' table (which contains user+pass info) is placed on 'foo1.com'
Posted: Fri Mar 16, 2007 3:01 pm
by feyd
You aren't allowed to set cookies for other domains. So, the next best thing is placing an identifier (like the session ID) in the URL's transferring the user between the servers.
Re: How to login into a site from another one?
Posted: Sun Mar 18, 2007 8:34 am
by neel_basu
guarriman wrote:Hi.
I've got 'foo1.com' where users log in by using PHP sessions. I store login and password hash into the session, and each time one user access a webpage, I check them.
But I've created 'foo2.com' and want users not to log in again on another login point, but using the 'foo1.com' login. I mean, if you are logged in 'foo1.com' you are also logged in 'foo2.com'. How to manage it? Must I create a webservice or something similar?
Thank you very much.
You Can Do It in 2 ways.
1. First Login On foo1 then after a Succesfull login on foo1 Use curl to loging on foo2.
2.Use Session Identifiers
I think Method 1 is The Siplest and Safest
Posted: Sun Mar 18, 2007 8:55 am
by louie35
post the form values to the other site login page.