Jump to content

Recommended Posts

Suppose I have two versions of the same website; one American and one Canadian.  This site has members with profiles etc.  The way my site is written, I think that if someone were to login to their account on, say, the American site, then a session variable would indicate that a user is logged in on the client machine.  Now if they visit the "profile" page, for example, or some other members-only page ON THE CANADIAN SITE, and start manipulating data etc., then this would affect the databases for the Canadian site, and everything would get screwed up (actually, I think mysql would just start spitting out errors, but that's not good either).

 

Does anyone have some simple way to deal this this kind of thing?  I don't really know exactly how session variables work.  Say I have two domains, somepage.com and somepage.ca on the same server/DNS.  If a page on somepage.com sets a session variable called $_SESSION['somevar'], and a page on somepage.ca also sets a variable called $_SESSION['somevar'], are the two variables somehow distinct because they are on different domains?  Like, if somepage.com sets the variable, then somepage.ca check if the variable is set, what will happen?  What if I wanted to set up the two pages in subfolders, like somepage.com/us and somepage.com/ca, how would I deal with distinguish session variables for the two sites?  Is one approach (i.e. distinct domains vs subfolders) better than the other?

 

Thanks,

By default two different applications can not share a session, so setting a session variable on one domain cannot be used on another domain to access information regardless of whether they have the same variable name set or not. Sessions are domain specific.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.