Wonder how your login to mail.yahoo.com makes you logged into my.yahoo.com ?
It’s game of give and take with cookies.
When you save your authentication cookie, you generally set it with its name value pair like
setcookie(“auth”, md5($_POST[‘user’] . $_POST[‘userpass’] ));
If you take a look at the other post about Cookies
Note the parameter domain it is this parameter that you need to use.
By default the domain parameter that gets set is the domain on which the cookie is being set. So if you save the cookie on http://mail.example.com/setcookie.php then the domain that is set is mail.example.com
So if you want a multiple domain login with my.example.com , photos.example.com you need to set the cookie with the base domain name like this.
setcookie(“auth”, md5($_POST[‘user’] . $_POST[‘userpass’] ), time()+(3*3600), “/”, “.example.com”);
Note .example.com this tells the browser that the cookie should be used for all the sub domains of example.com.
Thats it. You have a multiple domain login code.