Session cookies and multiple sites

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phibertek
Forum Newbie
Posts: 8
Joined: Thu Aug 23, 2007 12:34 pm

Session cookies and multiple sites

Post by phibertek »

Hello,

I have two sites, lets call them siteA.com and siteB.com. SiteA.com incorperates user posting from siteB.com (a blog site). On siteA.com, you can administer your blogs, write new blogs and they will post on siteB.com. The purpose of this is to split the users information from the actual site. SiteA.com has all the logic for authentication built into it. If you go to siteB.com, you can login to use your blogs there as well, but this is my question or problem.

I'm trying to make it that once you log into siteA.com, if you go to siteB.com, you are already logged in (logout vice versa). SiteA.com is based on a session cookie. SiteB.com has access to that session information sorted in a common database, but can't associate the cookie in the database with the user entering siteB.com. Is there anyway, once the user goes to siteB.com to understand the session cookie written in the DB and write that cookie out for it's domain without the users actually authenticating?

I know all of this siteA and siteB stuff sounds confusing, but I'm trying to be as clear as I can be. If anyone could explain how they would approach this problem, I would appreciate it.

-Phibertek
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

I am not sure, but *maybe* session_set_cookie_params() function will be in help.
There are 10 types of people in this world, those who understand binary and those who don't
phibertek
Forum Newbie
Posts: 8
Joined: Thu Aug 23, 2007 12:34 pm

RE: session_set_cookie_params()

Post by phibertek »

VladSun

I don't need help creating sessions. I'm trying to get advice on best way to pass a session from one domain to the next. Both domains have access to the same database, where the session is stored. Upon loading the second site, I need help figuring out how to associate the users on siteB.com with the session store and created by siteA.com.

Regards,

-Phibertek
phibertek
Forum Newbie
Posts: 8
Joined: Thu Aug 23, 2007 12:34 pm

Found some help

Post by phibertek »

User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: RE: session_set_cookie_params()

Post by VladSun »

phibertek wrote:VladSun

I don't need help creating sessions. I'm trying to get advice on best way to pass a session from one domain to the next. Both domains have access to the same database, where the session is stored. Upon loading the second site, I need help figuring out how to associate the users on siteB.com with the session store and created by siteA.com.

Regards,

-Phibertek
I know exactly what you've wanted ;)

My suggestion was an attempt to find a cookie based solution ... As I suspected, this solution is only applicable in one domain and across its subdomains.

E.g. :

a.site.com and b.site.com
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply