Keeping the same session_id when a page is refreshed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jaf893@gmail.com

    Keeping the same session_id when a page is refreshed

    I have the following script:

    <?PHP
    session_start() ;
    echo session_id();
    ?>

    But it gives a different session_ID() everytime the page is reloaded.
    Is there any way to keep the same session_ID() until the browser window
    is closed?

  • claudel@gmail.com

    #2
    Re: Keeping the same session_id when a page is refreshed

    There are two methods to propagate a session id: cookies & URL
    parameter.

    I suppose you are using the first one. The most probable cause is the
    fact that you do not have cookies enabled in your browser.

    Another thing might be the fact that you have not set up the
    session.save_pa th variable in php.ini...

    Clau

    Comment

    • jaf893@gmail.com

      #3
      Re: Keeping the same session_id when a page is refreshed

      I have cookies enabled and I have session.save_pa th setup in php.ini
      and it still doesn't work in either Firefox or Internet Explorer.

      Comment

      • claudel@gmail.com

        #4
        Re: Keeping the same session_id when a page is refreshed

        I`m blank then. The only times I had this problem was when
        session.save_pa th was pointing to a bogus directory _OR_ the disk was
        full/did not have write acces there. On Windows you should use single
        backslashes (i.e. w:\php\sessions ) with no trailing slash.

        Clau

        Comment

        • Chung Leong

          #5
          Re: Keeping the same session_id when a page is refreshed


          <jaf893@gmail.c om> wrote in message
          news:1105358280 .300156.7740@c1 3g2000cwb.googl egroups.com...[color=blue]
          > I have cookies enabled and I have session.save_pa th setup in php.ini
          > and it still doesn't work in either Firefox or Internet Explorer.
          >[/color]

          Make sure the folder in fact exists. PHP won't create it itself. And use
          forward slashes in the path even when it's on Windows. That's the preferred
          practice for both PHP and Apache.

          Do a print_r($_COOKI E) at the end of the page to see if you're actually
          receiving the cookie.


          Comment

          Working...