Noam
Noam

Reputation: 3391

Multiple php's $_SESSION variables from the same ip

If I open a new window in a browser, from the same computer I opened the last one, will it set up a new empty $_SESSION or will it use the one created by the last script I ran on this computer? Of-course both browser windows are running the same script..

If not, how can I do that?

If I work on two different browsers, will they share the session?

Thanks

Upvotes: 1

Views: 1022

Answers (3)

konsolenfreddy
konsolenfreddy

Reputation: 9671

New Windows (or Tabs) will use the same session.

You can prevent this by using the 'Private browsing' or 'Incognito' mode in newer Browsers. This will get you a fresh environment every time.

If you are on OSX, I can recommend Stainless (http://www.stainlessapp.com/) which uses the webkit engine and handles individual sessions within different tabs (See application preferences)

Upvotes: 2

Jeff Hubbard
Jeff Hubbard

Reputation: 9902

That depends. How are you handling the session id? Via the URL or cookies? If via cookies, are you setting them to live only until the browser closes, or until a certain time, or until a certain future time?

Upvotes: 2

DanielB
DanielB

Reputation: 20240

It will use the same session. Opening a new window is for the server the same as you would open it in the original window.

Upvotes: 1

Related Questions