I'm trying to make php multiple login as google account. For example, if we log in gmail then we also log on youtube, picasa, google+.
So for example I have two websites: www.site1.com and www.site2.com
I would like if the user is logged in site1.com then that moment also in site2.com login.
And what about the user database? whether just one or split? Sorry, my English is not good
you not able to share a session between domain or sub-domains. you should share a cookie between domain or dub-domain please check below link.
Sharing Cookies Between Domains
Sharing cookies between domains is trickier then sharing cookies between sub-domains of a single domain. An example of this working is the three domains owned by Microsoft, msnbc.com, msn.com, and microsoft.com, these three domains share the same cookie for each user. To share a cookie between domains, you will need two domains, for example myserver.com and slave.com. One of the domains will issue the cookies and the other domain will ask the first domain what cookie should be issued to the client. In this case myserver.com will issue the cookie and slave.com will use the cookie issued by myserver.com. Here is the code that myserver.com will use to issue the cookie:
Example 3 : cookie.inc
The object created in this example was demonstrated in the Apr 22, 1997 issue of 15 Seconds entitled: "Active Server Components with VB 5.0." You can download just the object from this issue (provided below) and use it in the code above. When the GetCookie method is called, a random 128-bit number is produced that is guaranteed to be unique to the user. UID stands for Unqiue IDentifer.
Notice that this code is contained in a cookie.inc file that can be included at the top of all Active Server pages within the myserver.com domain.
Requesting Cookie from Another Domain.
Now the interesting part, how does slave.com get the same cookie from domain.com. This technique is implemented through a set of redirects. Let's take a look at the code that is implemented on slave.com
Example 4 : getcookie.inc
0) Then strReturn= Server.URLEncode(strURL & "?" & strQueryString) Else strReturn= Server.URLEncode(strURL) End If Respone.Redirect("http://myserver.com/slave.asp?Return=" & strReturn) End If %>