Causes for $_SESSION to be only visible to current page?

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

    Causes for $_SESSION to be only visible to current page?

    Hi folks,

    I am working with PHP 4.3.8, Linux, and Apache 1.3.31 on a third-level or
    sub domain.

    The following code will diplay foo, session_id(), and increment count over
    refreshes:

    <?php
    session_start() ;
    $_SESSION['foo'] = 'bar';
    $_SESSION['count']++;
    print_r($_SESSI ON);
    echo session_id();
    ?>
    <a href="/test2.php">Next Page</a>


    But using the link to go to test2.php shows $_SESSION as undefined, not even
    an empty array.

    <?php
    print_r($_SESSI ON);
    echo 'Foo is registered? ' . session_is_regi stered('foo');
    echo session_id();
    ?>

    Any advice? The docs are quite clear that using session_start() should
    produce a persistant session for that browser. In IE the address of the
    second page shows no query string. But NN 7 magically shows

    da7 BUT the page itself does not have the session data in either browser.

    Help?

    TIA,

    jg


  • Jean

    #2
    Re: Causes for $_SESSION to be only visible to current page?

    jerrygarciuh wrote:
    [color=blue]
    > Any advice? The docs are quite clear that using session_start() should
    > produce a persistant session for that browser. In IE the address of the
    > second page shows no query string. But NN 7 magically shows
    > http://intranet.mysite.com/test2.php...1ffe394cac2ec7
    > da7 BUT the page itself does not have the session data in either browser.[/color]

    session_start() ; in test2.php?

    --
    Mijn Project Pagina.
    Vind mijn documenten, projecten en howto's op

    Comment

    • jerrygarciuh

      #3
      Re: Causes for $_SESSION to be only visible to current page?

      Jean,

      Thanks, that solved it but don't you think it is a little bizarre to have
      to call that on every page?

      It is so counter-intuitive to me!

      Thanks for resolving my problem!!

      jg


      "Jean"
      <bleh@boeitmijn iet.be.blah.com .boe.bah.bleh.z ie.je.eindigt.m et.punt.invalid >
      wrote in message news:JYk_c.2362 93$3O.12186670@ phobos.telenet-ops.be...[color=blue]
      > jerrygarciuh wrote:
      >[color=green]
      > > Any advice? The docs are quite clear that using session_start() should
      > > produce a persistant session for that browser. In IE the address of the
      > > second page shows no query string. But NN 7 magically shows
      > >[/color][/color]
      http://intranet.mysite.com/test2.php...1ffe394cac2ec7[color=blue][color=green]
      > > da7 BUT the page itself does not have the session data in either[/color][/color]
      browser.[color=blue]
      >
      > session_start() ; in test2.php?
      >
      > --
      > Mijn Project Pagina.
      > Vind mijn documenten, projecten en howto's op
      > http://www.npi.be[/color]


      Comment

      • Jean

        #4
        Re: Causes for $_SESSION to be only visible to current page?

        jerrygarciuh wrote:
        [color=blue]
        > Jean,
        >
        > Thanks, that solved it but don't you think it is a little bizarre to have
        > to call that on every page?[/color]



        It says:
        *session_start( )* creates a session or resumes the current one based on
        the current session id that's being passed via a request, such as GET,
        POST, or a cookie.
        [color=blue]
        > It is so counter-intuitive to me![/color]

        Sometimes reading the manual helps :D
        [color=blue]
        > Thanks for resolving my problem!![/color]

        You're welcome.

        --
        Mijn Project Pagina.
        Vind mijn documenten, projecten en howto's op

        Comment

        • Alvaro G. Vicario

          #5
          Re: Causes for $_SESSION to be only visible to current page?

          *** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:05:02 -0500):[color=blue]
          > But using the link to go to test2.php shows $_SESSION as undefined, not even
          > an empty array.
          >
          > <?php
          > print_r($_SESSI ON);
          > echo 'Foo is registered? ' . session_is_regi stered('foo');
          > echo session_id();
          > ?>[/color]
          [color=blue]
          > Any advice? The docs are quite clear that using session_start() should
          > produce a persistant session for that browser.[/color]

          Yet you haven't used session_start() , at least in the code you paste :-?


          --
          --
          -+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
          +- http://www.demogracia.com (la web de humor para mayores de 100 años)
          ++ «Sonríe, que te vamos a hacer una foto para la esquela»
          --

          Comment

          • Alvaro G. Vicario

            #6
            Re: Causes for $_SESSION to be only visible to current page?

            *** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:23:13 -0500):[color=blue]
            > Thanks, that solved it but don't you think it is a little bizarre to have
            > to call that on every page?[/color]

            What if you don't need session data in 95% of your pages?


            --
            --
            -+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
            +- http://www.demogracia.com (la web de humor para mayores de 100 años)
            ++ «Sonríe, que te vamos a hacer una foto para la esquela»
            --

            Comment

            • jerrygarciuh

              #7
              Re: Causes for $_SESSION to be only visible to current page?

              Thanks!
              jg


              "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote in message
              news:1hf2sgmy2a 5gc.779zp6rgirn p.dlg@40tude.ne t...[color=blue]
              > *** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:05:02 -0500):[color=green]
              > > But using the link to go to test2.php shows $_SESSION as undefined, not[/color][/color]
              even[color=blue][color=green]
              > > an empty array.
              > >
              > > <?php
              > > print_r($_SESSI ON);
              > > echo 'Foo is registered? ' . session_is_regi stered('foo');
              > > echo session_id();
              > > ?>[/color]
              >[color=green]
              > > Any advice? The docs are quite clear that using session_start() should
              > > produce a persistant session for that browser.[/color]
              >
              > Yet you haven't used session_start() , at least in the code you paste :-?
              >
              >
              > --
              > --
              > -+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
              > +- http://www.demogracia.com (la web de humor para mayores de 100 años)
              > ++ «Sonríe, que te vamos a hacer una foto para la esquela»
              > --[/color]


              Comment

              • jerrygarciuh

                #8
                Re: Causes for $_SESSION to be only visible to current page?

                Excellent point!
                jg


                "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote in message
                news:8xgorz2gzg r5$.mln8l7fqsjr f.dlg@40tude.ne t...[color=blue]
                > *** jerrygarciuh escribió/wrote (Sat, 4 Sep 2004 10:23:13 -0500):[color=green]
                > > Thanks, that solved it but don't you think it is a little bizarre to[/color][/color]
                have[color=blue][color=green]
                > > to call that on every page?[/color]
                >
                > What if you don't need session data in 95% of your pages?
                >
                >
                > --
                > --
                > -+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
                > +- http://www.demogracia.com (la web de humor para mayores de 100 años)
                > ++ «Sonríe, que te vamos a hacer una foto para la esquela»
                > --[/color]


                Comment

                Working...