Session dies after HEader redirect

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

    Session dies after HEader redirect

    I appreciate the links on the session variables. I had actually hit that
    and finished the login and supporting pages. Thanks for everything.

    I noticed that PHP.NET said to do a HEADER Location: for a client re-direct.
    When I do that thoughm it seems either the session is destroyed, or the ID
    is lost. If I set session variables, then do a Header redirect, the
    variables are empty at the new page. While I *could* just say "You are now
    logged in, click here to continue", tht sounds kind of silly to me. Any
    other way?

    bt3of4


  • R. Rajesh Jeba Anbiah

    #2
    Re: Session dies after HEader redirect

    BT3 wrote:[color=blue]
    > I appreciate the links on the session variables. I had actually hit[/color]
    that[color=blue]
    > and finished the login and supporting pages. Thanks for everything.
    >
    > I noticed that PHP.NET said to do a HEADER Location: for a client[/color]
    re-direct.[color=blue]
    > When I do that thoughm it seems either the session is destroyed, or[/color]
    the ID[color=blue]
    > is lost. If I set session variables, then do a Header redirect, the
    > variables are empty at the new page. While I *could* just say "You[/color]
    are now[color=blue]
    > logged in, click here to continue", tht sounds kind of silly to me.[/color]
    Any[color=blue]
    > other way?[/color]

    This is known behaviour for non-cookie based sessions. Workaround:
    append SID *manually*--but only for redirection.

    --
    <?php echo 'Just another PHP saint'; ?>
    Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

    Comment

    • BT3

      #3
      Re: Session dies after HEader redirect

      new problem.
      I'm doing a session_start() ; at the beginning of the script.
      Towards the end of the script I'm setting up the redirection, but SID
      doesn't return anything.

      Bt3of4

      "BT3" <honeypot@epmct c.com> wrote in message
      news:JMdfe.876$ Db6.565@okeprea d05...[color=blue]
      > I appreciate the links on the session variables. I had actually hit that
      > and finished the login and supporting pages. Thanks for everything.
      >
      > I noticed that PHP.NET said to do a HEADER Location: for a client[/color]
      re-direct.[color=blue]
      > When I do that thoughm it seems either the session is destroyed, or the ID
      > is lost. If I set session variables, then do a Header redirect, the
      > variables are empty at the new page. While I *could* just say "You are[/color]
      now[color=blue]
      > logged in, click here to continue", tht sounds kind of silly to me. Any
      > other way?
      >
      > bt3of4
      >
      >[/color]


      Comment

      • Mike Willbanks

        #4
        Re: Session dies after HEader redirect

        This needs to have a few configuration options changed...

        Note that getting the sessionid MUST be called before session_start()
        otherwise you will replace the current sessionid.

        Therefore you should retrieve it as follows:

        session_start() ;
        //your code
        session_write_c lose();
        $sessid = session_id();

        This way the session is closed and then you can retrieve the id :)

        Mike

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: Session dies after HEader redirect

          BT3 wrote:[color=blue]
          > new problem.
          > I'm doing a session_start() ; at the beginning of the script.
          > Towards the end of the script I'm setting up the redirection, but SID
          > doesn't return anything.[/color]

          That means, session id is not found in the query string. Constant
          SID and session_id() function are different.

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          Working...