By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,045 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,045 IT Pros & Developers. It's quick & easy.

Simultaneous sessions ?

P: n/a
Hello again,

I still do not master everything about cookies and session. :o/

After some tests, I understood that when a visitor has several browser
windows open on my website, the same session id is used for all.

The consequence is that if the data are changing in one window, they
will also change in another one.

So before reinventing the wheel, is there a mean for a visitor to have
several sessions opened on my website (one session per window open for
example)?

thanks.

--
Florence HENRY
florence point henry arobasse obspm point fr

Jul 17 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Is there a mean for the visitor? I really don't know! Do you sometimes
have multiple windows open where you have the site www.google.com loaded
I do that occasionally.

But to return to the browser/session thingy...

If a user uses CTRL+N a new window (assuming Winblows Internet Exploder)
is opened and the session-id in the new window is exactly the same as
the originating window. If they click the shortcut on the desktop or in
the start menu or wherever else they set the shortcut, than that browser
has a new session-id....

Mark

Florence HENRY wrote:
Hello again,

I still do not master everything about cookies and session. :o/

After some tests, I understood that when a visitor has several browser
windows open on my website, the same session id is used for all.

The consequence is that if the data are changing in one window, they
will also change in another one.

So before reinventing the wheel, is there a mean for a visitor to have
several sessions opened on my website (one session per window open for
example)?

thanks.

--
Florence HENRY
florence point henry arobasse obspm point fr

Jul 17 '05 #2

P: n/a
On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
<maluka@remove_this.koekeloekoe.nl> wrote:
Is there a mean for the visitor? I really don't know! Do you sometimes
have multiple windows open where you have the site www.google.com loaded
I do that occasionally.

But to return to the browser/session thingy...

If a user uses CTRL+N a new window (assuming Winblows Internet Exploder)
is opened and the session-id in the new window is exactly the same as
the originating window. If they click the shortcut on the desktop or in
the start menu or wherever else they set the shortcut, than that browser
has a new session-id....


When I browse, I often open several windows looking at different pages
of the same site. I rely upon them all using the same session id.

I would have expected opening a second instance of the browser would
also behave the same way. The session id is stored in a cookie and
cookies will be shared across browser instances.

The OP could generate his session ids manually and pass them via GET
to persist them in the same browser window. I haven't fully thought
that through, so there's probably a flaw in there somewhere.

--
David ( @priz.co.uk )
Jul 17 '05 #3

P: n/a
Internally sessions are identified by one of two methods; cookies or url
rewriting.

The usual case is using cookies. These cookies are 'soft' cookies which
are kept only in memory. Extra browser windows opened by target=xx in
your HTML or by JavaScript window.open() inherit the parent's
environment including the PHP session id and hence share the same session.

Browser windows opened from elsewhere (start menu, shortcut etc) will
not inherit the environment and will have a different session id.

URL rewriting works much the same way, php parses any <a> tags after
generating your web page and adds the php session id to the query string.
Jul 17 '05 #4

P: n/a
"Mark Kuiphuis" <maluka@remove_this.koekeloekoe.nl> wrote in message
news:c4**********@reader11.wxs.nl...
If a user uses CTRL+N a new window (assuming Winblows Internet Exploder)
is opened and the session-id in the new window is exactly the same as
the originating window. If they click the shortcut on the desktop or in
the start menu or wherever else they set the shortcut, than that browser
has a new session-id....


It all depends on whether the browsers belong to the same process. If they
do, then session cookies (ones that vanish when the browser shuts down) are
shared. On systems with more than 32megs of memory, a new process will start
every time you double-click the IE icon. When you open a new window by
hitting Ctrl-N, or through File > Open, or by holding down the ctrl key when
you click on a link, that window will stay with the parent process. On
systems with less than 32megs of ram, all browser windows (as well as the
Windows shell)are of the same process.

Netscape and Opera will run only as one process, so session cookies are
always shared.

As far as I know there is no way you can associate a HTTP request with a
particular window. You might be able to create some kind of locking
mechanism by setting a cookie value in the onload handler, and clearing it
in onunload, but I doubt it would work very well.
Jul 17 '05 #5

P: n/a
Le mercredi 31 Mars 2004 17:16, David Mackenzie a déclaré:
On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
<maluka@remove_this.koekeloekoe.nl> wrote:
Is there a mean for the visitor? I really don't know! Do you sometimes
have multiple windows open where you have the site www.google.com loaded
I do that occasionally. When I browse, I often open several windows looking at different pages
of the same site. I rely upon them all using the same session id.


The goal of the pages I'm writing is to consult scientific data. So a
visitor may have a browser window for data acquired on day A, and another
one with data acquired on day B. I do not want that when he reloads the
page A, he gets B data ! So there is a mean for the visitor!!!
The OP could generate his session ids manually and pass them via GET
to persist them in the same browser window. I haven't fully thought
that through, so there's probably a flaw in there somewhere.


A solution that I tried was to generate a new id each time the visitor was
visiting the first page of the website, but in that case, a new id is also
generated each time you reload the page, and the /tmp is getting filled
with empty sessions...

--
Florence Henry
florence point henry arobasse obspm point fr
Jul 17 '05 #6

P: n/a
On Thu, 01 Apr 2004 10:37:52 +0200, Florence HENRY
<ra******@duspam.fr> wrote:
Le mercredi 31 Mars 2004 17:16, David Mackenzie a déclaré:
On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
<maluka@remove_this.koekeloekoe.nl> wrote:
Is there a mean for the visitor? I really don't know! Do you sometimes
have multiple windows open where you have the site www.google.com loaded
I do that occasionally.

When I browse, I often open several windows looking at different pages
of the same site. I rely upon them all using the same session id.


The goal of the pages I'm writing is to consult scientific data. So a
visitor may have a browser window for data acquired on day A, and another
one with data acquired on day B. I do not want that when he reloads the
page A, he gets B data ! So there is a mean for the visitor!!!


Then can you not pass something on the URL, e.g. data.php?day=A

--
David ( @priz.co.uk )
Jul 17 '05 #7

P: n/a
> The goal of the pages I'm writing is to consult scientific data. So a
visitor may have a browser window for data acquired on day A, and another
one with data acquired on day B. I do not want that when he reloads the
page A, he gets B data ! So there is a mean for the visitor!!!


In that case 'day' is variable between windows and should be passed in
the URL.

Session data is data shared across the whole application.

Of course you could load your actual data into sessions but keyed by a
'day' passed in the URL.
Jul 17 '05 #8

P: n/a
Le jeudi 1 Avril 2004 12:22, Kevin Thorpe a déclaré:
The goal of the pages I'm writing is to consult scientific data. So a
visitor may have a browser window for data acquired on day A, and another
one with data acquired on day B. I do not want that when he reloads the
page A, he gets B data ! So there is a mean for the visitor!!!


In that case 'day' is variable between windows and should be passed in
the URL.


Sure, but there is plenty of information (other than day) that have to be
passed. I wanted to use cookies in order to avoid passing all the
parameters with GET or POST.

--
Florence Henry
florence point henry arobasse obspm point fr
Jul 17 '05 #9

P: n/a
Florence HENRY wrote:
Le jeudi 1 Avril 2004 12:22, Kevin Thorpe a déclaré:

The goal of the pages I'm writing is to consult scientific data. So a
visitor may have a browser window for data acquired on day A, and another
one with data acquired on day B. I do not want that when he reloads the
page A, he gets B data ! So there is a mean for the visitor!!!


In that case 'day' is variable between windows and should be passed in
the URL.

Sure, but there is plenty of information (other than day) that have to be
passed. I wanted to use cookies in order to avoid passing all the
parameters with GET or POST.

In that case, as I suggested create some sort of unique key which will
be passed in GET/POST and store the rest in SESSION under that key.
Jul 17 '05 #10

P: n/a
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<OO********************@comcast.com>...
"Mark Kuiphuis" <maluka@remove_this.koekeloekoe.nl> wrote in message
news:c4**********@reader11.wxs.nl...
If a user uses CTRL+N a new window (assuming Winblows Internet Exploder)
is opened and the session-id in the new window is exactly the same as
the originating window. If they click the shortcut on the desktop or in
the start menu or wherever else they set the shortcut, than that browser
has a new session-id....


It all depends on whether the browsers belong to the same process. If they
do, then session cookies (ones that vanish when the browser shuts down) are
shared.


We can set the session cookie to be persistent across browser
sessions. <http://in2.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime>

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #11

P: n/a
Le vendredi 2 Avril 2004 07:06, R. Rajesh Jeba Anbiah a déclaré:
We can set the session cookie to be persistent across browser
sessions.
<http://in2.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime>


It is exactly the opposite of what I want... I want that each window and
each tab have their own session number.

--
Florence Henry
florence point henry arobasse obspm point fr
Jul 17 '05 #12

P: n/a
Le jeudi 1 Avril 2004 15:08, Kevin Thorpe a déclaré:
Sure, but there is plenty of information (other than day) that have to be
passed. I wanted to use cookies in order to avoid passing all the
parameters with GET or POST.

In that case, as I suggested create some sort of unique key which will
be passed in GET/POST and store the rest in SESSION under that key.


When I read your answear yesterday, I thought it was the good solution, but
there is still some problems : if the visitor wants to open the content of
a window into a new window (I cannot forbid this !), both windows will have
the same key session. And a modification in one will occur on th other one.

I really wonder if using cookies for my job is the good solution.

--
Florence Henry
florence point henry arobasse obspm point fr
Jul 17 '05 #13

P: n/a
Florence HENRY wrote:
Le jeudi 1 Avril 2004 15:08, Kevin Thorpe a déclaré:

Sure, but there is plenty of information (other than day) that have to be
passed. I wanted to use cookies in order to avoid passing all the
parameters with GET or POST.


In that case, as I suggested create some sort of unique key which will
be passed in GET/POST and store the rest in SESSION under that key.

When I read your answear yesterday, I thought it was the good solution, but
there is still some problems : if the visitor wants to open the content of
a window into a new window (I cannot forbid this !), both windows will have
the same key session. And a modification in one will occur on th other one.

I really wonder if using cookies for my job is the good solution.


You'll have to use GET/POST for this I think.

You will need a link somewhere 'start a new view' which opens
'view_start.php' which generates a unique $view_id, adds default
parameters and data to the array $_SESSION['views'][$view_id] then
redirects to default_view.php?view=$view_id. All links/forms within your
viewer pages will have to propogate $view_id to pick up the correct
parameter/data set from $_SESSION['views'].

Jul 17 '05 #14

P: n/a
Le vendredi 2 Avril 2004 12:08, Kevin Thorpe a déclaré:
You'll have to use GET/POST for this I think.

You will need a link somewhere 'start a new view' which opens
'view_start.php' which generates a unique $view_id, adds default
parameters and data to the array $_SESSION['views'][$view_id] then
redirects to default_view.php?view=$view_id. All links/forms within your
viewer pages will have to propogate $view_id to pick up the correct
parameter/data set from $_SESSION['views'].


That sounds to be a good solution. Thanks.

--
Florence Henry
florence point henry arobasse obspm point fr
Jul 17 '05 #15

P: n/a
Florence HENRY <ra******@duspam.fr> wrote in message news:<c4**********@carbone.net.espci.fr>...
Le vendredi 2 Avril 2004 07:06, R. Rajesh Jeba Anbiah a déclaré:
We can set the session cookie to be persistent across browser
sessions.
<http://in2.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime>


It is exactly the opposite of what I want... I want that each window and
each tab have their own session number.


My response was to the idea that session cookie can be persistent
across browser sessions.

If you want new session for every browser window, then you don't
need session at all. Kevin already gave you the answer.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #16

P: n/a
Florence HENRY <ra******@duspam.fr> wrote in message news:<c4**********@carbone.net.espci.fr>...
Le vendredi 2 Avril 2004 07:06, R. Rajesh Jeba Anbiah a déclaré:
We can set the session cookie to be persistent across browser
sessions.
<http://in2.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime>


It is exactly the opposite of what I want... I want that each window and
each tab have their own session number.


My response was to the idea that session cookie can be persistent
across browser sessions.

If you want new session for every browser window, then you don't
need session at all. Kevin already gave you the answer.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.