session_start() works wrong for me

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

    session_start() works wrong for me

    I have problem with sessions. I make this without cookies but by
    propagate session ID by GET.

    I have make session by calling session_start() after test login and
    password with database. After that i register a one session variable.

    My problem is when i later call session_start() . This (second) call
    make me new session (second), but not rectivate and introduce
    back frozen variables of my first (correct) session to the global
    namespace. I think this situation happens when URL doesn't contain
    session ID. Is the reason or maybe something else ?

    --
    pozdr.;)
    ~xEM
  • Erwin Moller

    #2
    Re: session_start() works wrong for me

    xEM wrote:
    [color=blue]
    > I have problem with sessions. I make this without cookies but by
    > propagate session ID by GET.
    >
    > I have make session by calling session_start() after test login and
    > password with database. After that i register a one session variable.
    >
    > My problem is when i later call session_start() . This (second) call
    > make me new session (second), but not rectivate and introduce
    > back frozen variables of my first (correct) session to the global
    > namespace. I think this situation happens when URL doesn't contain
    > session ID. Is the reason or maybe something else ?
    >[/color]

    Hi,

    Maybe you have a few pages inbetween that doesn't propagate the sessionid in
    the GET?

    Regards,
    Erwin Moller

    Comment

    • Joshua Beall

      #3
      Re: session_start() works wrong for me


      "xEM" <me@o2.pl> wrote in message news:slrnc66vpj .3ve.me@192.168 .1.5...[color=blue]
      > I have problem with sessions. I make this without cookies but by
      > propagate session ID by GET.
      >
      > I have make session by calling session_start() after test login and
      > password with database. After that i register a one session variable.
      >
      > My problem is when i later call session_start() . This (second) call
      > make me new session (second), but not rectivate and introduce
      > back frozen variables of my first (correct) session to the global
      > namespace. I think this situation happens when URL doesn't contain
      > session ID. Is the reason or maybe something else ?[/color]

      Yes, this is the problem. If you are not propagating the session ID via
      cookie, then the only way for it to propagate is via the GET string. If you
      *ever* have the browser move from one page to the next without sending that
      SID in the GET string, the session, and all data associated with it, becomes
      unretrievable by PHP.

      You should propagate with cookies when the client will let you.

      -jb


      Comment

      • xEM

        #4
        Re: session_start() works wrong for me

        On 2004-03-26, Joshua Beall <jbeall@donotsp am.remove.me.he raldic.us> wrote:
        [color=blue]
        > You should propagate with cookies when the client will let you.
        >[/color]

        How can i check if clinet may use cookies ?

        --
        pozdr.;)
        ~xEM

        Comment

        • Joshua Beall

          #5
          Re: session_start() works wrong for me

          > How can i check if clinet may use cookies ?

          Unfortunately, I do not think there is an easy way, or even any way, to do
          this within a single script. If you get the cookie back on the second page,
          you know that the client is accepting cookies.

          If you have transparent session IDs enabled, the PHP should automatically
          try both. If it gets the cookie back on the second page, it knows that the
          browser accepted the cookie on the first page, and will stop rewriting
          links.

          Perhaps someone who is more knowledgeable will shed some more light on this
          subject.

          You can read about sessions here: http://us2.php.net/session


          Comment

          Working...