473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Simultaneous sessions ?

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
16 4404
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
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
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
"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
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
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
> 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
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
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
"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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Claudio Grondi | last post by:
I would like to save time copying the same file (>6 GByte) to various different target storage media connected to the system via USB. Is there a (Python or other) tool able to help me to do...
1
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
6
by: Jimnbigd | last post by:
I want to write a game, and sounds will really add to it. Note that I would always make the sounds optional. I hate it when I go to a URL and unexpectedly get sounds or music. I have played...
1
by: Semaj | last post by:
Environment: DB2 8.1.4; Windows 2000 We are evaluating the feasibility of upgrading our production DB from 7.2 to 8.1. During this process we've encountered an error when starting our...
1
by: pmclinn | last post by:
I have created a aspx page that requires me to pull data from multiple tables in an Oracle DB. The data is pulled down and then stored in local variables, and then closed and disposed. I have...
12
by: Dan V. | last post by:
Since an ASP.NET/ADO.NET website is run on the server by a single "asp_net worker process", therefore doesn't that mean that even 50 simultaneous human users of the website would appear to the...
2
by: dmagliola | last post by:
Hello all, I'm experiencing a problem with ASP.Net for which I can't find a reasonable explanation, or any information. I'm currently developing an application that, through AJAX, asks the...
0
by: rajaaswin | last post by:
say i open gmail using pamie enter credentials and sign in..... next i create another pamie instance but it directly enters the already entered user account without asking for credentials.... wat...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.