Simultaneous sessions ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Florence HENRY

    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

  • Mark Kuiphuis

    #2
    Re: Simultaneous sessions ?

    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:[color=blue]
    > 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
    >[/color]

    Comment

    • David Mackenzie

      #3
      Re: Simultaneous sessions ?

      On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
      <maluka@remove_ this.koekeloeko e.nl> wrote:
      [color=blue]
      >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....[/color]

      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 )

      Comment

      • Kevin Thorpe

        #4
        Re: Simultaneous sessions ?

        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.

        Comment

        • Chung Leong

          #5
          Re: Simultaneous sessions ?

          "Mark Kuiphuis" <maluka@remove_ this.koekeloeko e.nl> wrote in message
          news:c4ej3q$n87 $1@reader11.wxs .nl...[color=blue]
          > 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....[/color]

          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.


          Comment

          • Florence HENRY

            #6
            Re: Simultaneous sessions ?

            Le mercredi 31 Mars 2004 17:16, David Mackenzie a déclaré:
            [color=blue]
            > On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
            > <maluka@remove_ this.koekeloeko e.nl> wrote:
            >[color=green]
            >>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.[/color]
            > 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.[/color]

            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!!!
            [color=blue]
            > 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.[/color]

            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

            Comment

            • David Mackenzie

              #7
              Re: Simultaneous sessions ?

              On Thu, 01 Apr 2004 10:37:52 +0200, Florence HENRY
              <raslebol@duspa m.fr> wrote:
              [color=blue]
              >Le mercredi 31 Mars 2004 17:16, David Mackenzie a déclaré:
              >[color=green]
              >> On Wed, 31 Mar 2004 15:57:34 +0200, Mark Kuiphuis
              >> <maluka@remove_ this.koekeloeko e.nl> wrote:
              >>[color=darkred]
              >>>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.[/color]
              >> 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.[/color]
              >
              >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!!![/color]

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

              --
              David ( @priz.co.uk )

              Comment

              • Kevin Thorpe

                #8
                Re: Simultaneous sessions ?

                > The goal of the pages I'm writing is to consult scientific data. So a[color=blue]
                > 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!!![/color]

                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.

                Comment

                • Florence HENRY

                  #9
                  Re: Simultaneous sessions ?

                  Le jeudi 1 Avril 2004 12:22, Kevin Thorpe a déclaré:
                  [color=blue][color=green]
                  >> 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!!![/color]
                  >
                  > In that case 'day' is variable between windows and should be passed in
                  > the URL.[/color]

                  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

                  Comment

                  • Kevin Thorpe

                    #10
                    Re: Simultaneous sessions ?

                    Florence HENRY wrote:[color=blue]
                    > Le jeudi 1 Avril 2004 12:22, Kevin Thorpe a déclaré:
                    >
                    >[color=green][color=darkred]
                    >>>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!!![/color]
                    >>
                    >>In that case 'day' is variable between windows and should be passed in
                    >>the URL.[/color]
                    >
                    >
                    > 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.
                    >[/color]
                    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.


                    Comment

                    • R. Rajesh Jeba Anbiah

                      #11
                      Re: Simultaneous sessions ?

                      "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<OOSdnT3Nm rSDw_bdRVn-iQ@comcast.com> ...[color=blue]
                      > "Mark Kuiphuis" <maluka@remove_ this.koekeloeko e.nl> wrote in message
                      > news:c4ej3q$n87 $1@reader11.wxs .nl...[color=green]
                      > > 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....[/color]
                      >
                      > 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.[/color]

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

                      --
                      http://www.sendmetoindia.com - Send Me to India!
                      Email: rrjanbiah-at-Y!com

                      Comment

                      • Florence HENRY

                        #12
                        Re: Simultaneous sessions ?

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

                        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

                        Comment

                        • Florence HENRY

                          #13
                          Re: Simultaneous sessions ?

                          Le jeudi 1 Avril 2004 15:08, Kevin Thorpe a déclaré:
                          [color=blue][color=green]
                          >> 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.
                          >>[/color]
                          > 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.[/color]

                          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

                          Comment

                          • Kevin Thorpe

                            #14
                            Re: Simultaneous sessions ?

                            Florence HENRY wrote:[color=blue]
                            > Le jeudi 1 Avril 2004 15:08, Kevin Thorpe a déclaré:
                            >
                            >[color=green][color=darkred]
                            >>>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.
                            >>>[/color]
                            >>
                            >>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.[/color]
                            >
                            >
                            > 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.[/color]

                            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.ph p?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'].

                            Comment

                            • Florence HENRY

                              #15
                              Re: Simultaneous sessions ?

                              Le vendredi 2 Avril 2004 12:08, Kevin Thorpe a déclaré:
                              [color=blue]
                              > 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.ph p?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'].[/color]

                              That sounds to be a good solution. Thanks.

                              --
                              Florence Henry
                              florence point henry arobasse obspm point fr

                              Comment

                              Working...