Session_Start() Doesn't Work

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

    #1

    Session_Start() Doesn't Work

    Hi

    I'm new to PHP and I'm trying to create a Login Form. Once the user has
    logged in then he shouldn't have to log in again. The trouble is I'm getting
    a new session ID between every page and so it doesn't recognise the user.
    I've used Session_Start() which I thought was meant to maintain the session
    variables between pages but it doesn't do work.

    Any ideas or FAQ's?

    Thanks
    Chris


  • Virgil Green

    #2
    Re: Session_Start() Doesn't Work

    "Chris Allen" <c.allen@nospam .co.uk> wrote in message
    news:c61gne$sm1 $1@hercules.bti nternet.com...[color=blue]
    > Hi
    >
    > I'm new to PHP and I'm trying to create a Login Form. Once the user has
    > logged in then he shouldn't have to log in again. The trouble is I'm[/color]
    getting[color=blue]
    > a new session ID between every page and so it doesn't recognise the user.
    > I've used Session_Start() which I thought was meant to maintain the[/color]
    session[color=blue]
    > variables between pages but it doesn't do work.
    >
    > Any ideas or FAQ's?
    >
    > Thanks
    > Chris[/color]

    Are you using session_start on every page? Are you certain your system is
    properly configured to store the sessions? Are you registering your
    variables with the session so they are available on the "next" page?

    - Virgil


    Comment

    • Chris Allen

      #3
      Re: Session_Start() Doesn't Work

      > Are you using session_start on every page? Are you certain your system is[color=blue]
      > properly configured to store the sessions?[/color]

      I dunno how do I check?
      [color=blue]
      > Are you registering your
      > variables with the session so they are available on the "next" page?[/color]

      I've got session_start() on each page if that's what you mean.


      "Virgil Green" <vjg@obsydian.c om> wrote in message
      news:9NXgc.9135 $Jx6.8779@newss vr24.news.prodi gy.com...[color=blue]
      > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
      > news:c61gne$sm1 $1@hercules.bti nternet.com...[color=green]
      > > Hi
      > >
      > > I'm new to PHP and I'm trying to create a Login Form. Once the user has
      > > logged in then he shouldn't have to log in again. The trouble is I'm[/color]
      > getting[color=green]
      > > a new session ID between every page and so it doesn't recognise the[/color][/color]
      user.[color=blue][color=green]
      > > I've used Session_Start() which I thought was meant to maintain the[/color]
      > session[color=green]
      > > variables between pages but it doesn't do work.
      > >
      > > Any ideas or FAQ's?
      > >
      > > Thanks
      > > Chris[/color]
      >
      > Are you using session_start on every page? Are you certain your system is
      > properly configured to store the sessions? Are you registering your
      > variables with the session so they are available on the "next" page?
      >
      > - Virgil
      >
      >[/color]


      Comment

      • Phil Roberts

        #4
        Re: Session_Start() Doesn't Work

        With total disregard for any kind of safety measures "Chris Allen"
        <c.allen@nospam .co.uk> leapt forth and uttered:
        [color=blue][color=green]
        >> Are you using session_start on every page? Are you certain your
        >> system is properly configured to store the sessions?[/color]
        >
        > I dunno how do I check?
        >[color=green]
        >> Are you registering your
        >> variables with the session so they are available on the "next"
        >> page?[/color]
        >
        > I've got session_start() on each page if that's what you mean.
        >[/color]

        No, you need to explicity define the variables you want stored in
        the session.

        For example:

        <?php

        session_start() ;

        $_SESSION['my_var'] = 'Some data';

        ?>

        --
        Phil Roberts | Dork Pretending To Be Hard | http://www.flatnet.net/

        Comment

        • Virgil Green

          #5
          Re: Session_Start() Doesn't Work

          "Chris Allen" <c.allen@nospam .co.uk> wrote in message
          news:c61m16$77c $1@titan.btinte rnet.com...[color=blue][color=green]
          > > Are you using session_start on every page? Are you certain your system[/color][/color]
          is[color=blue][color=green]
          > > properly configured to store the sessions?[/color]
          >
          > I dunno how do I check?[/color]

          View the output of a phpinfo() function. Checll all the 'session.*'
          properties. Does it match your system and the way you want sessions to be
          processed? Also check the url_rewriter.ta gs property.
          [color=blue][color=green]
          > > Are you registering your
          > > variables with the session so they are available on the "next" page?[/color]
          >
          > I've got session_start() on each page if that's what you mean.[/color]

          No, as Phil said, you have to put the fields in the $_SESSION array or, if
          you are using the older scheme, use the session_registe r() function for each
          variable you want registered.

          Only registered variables (either method) will be retained across page
          calls.

          - Virgil


          Comment

          • Javier_

            #6
            Re: Session_Start() Doesn't Work

            Chris,

            I ran across the same problem a couple of weeks ago. Some hosting
            companies require special magic lines of code and incantations :) (I
            don't know if you are using a hosting company but...) After much
            searching on my hosting company's support site I found that not only
            is it required to have the Session_Start() function at the top of
            every page but additionally they required session_save_pa th() to be
            explicity set as well at the top of every page. See below.

            <?php
            session_save_pa th("/some/path/with/permissions/for/your/account");
            Session_Start() ;

            $_SESSION['user']=$username;

            ?>

            It worked for me.

            There is also a function that will echo out the current
            session_save_pa th if you're curious but I couldn't find it again.

            buena suerte! my two cents.

            Javier
            aed7@deadspam.h otmail.com




            On Mon, 19 Apr 2004 21:35:42 +0000 (UTC), "Chris Allen"
            <c.allen@nospam .co.uk> wrote:
            [color=blue]
            >Hi
            >
            >I'm new to PHP and I'm trying to create a Login Form. Once the user has
            >logged in then he shouldn't have to log in again. The trouble is I'm getting
            >a new session ID between every page and so it doesn't recognise the user.
            >I've used Session_Start() which I thought was meant to maintain the session
            >variables between pages but it doesn't do work.
            >
            >Any ideas or FAQ's?
            >
            >Thanks
            >Chris
            >[/color]

            Comment

            • Chris Allen

              #7
              Re: Session_Start() Doesn't Work


              Hello Again,

              Thanks for you replies. Yes I am using $_SESSION['favcolour']='blue'. In
              fact I created page1.php and page2.php from the PHP documentation on
              session_start() and it doesn't work for me either. My favcolour=green and
              animal=cat on page1 but are blank on page2. I've got low security and
              privacy settings and I've tried IE, Mozilla & Opera.

              Here's Page 1:

              <?php
              // page1.php

              session_start() ;

              echo 'Welcome to page #1<br><br>';

              $_SESSION['favcolor'] = 'green';
              $_SESSION['animal'] = 'cat';
              $_SESSION['time'] = time();

              echo 'Session ID='.session_id ().'<br />';
              echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
              echo 'animal='.$_SES SION['animal'];
              // Works if session cookie was accepted
              echo '<br /><a href="page2.php ">page 2</a>';

              // Or maybe pass along the session id, if needed
              echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
              ?>

              Here's page 2.

              <?php
              // page2.php

              session_start() ;

              echo 'Welcome to page #2<br /><br>';

              echo 'Session ID='.session_id ().'<br />';
              echo 'favcolour='.$_ SESSION['favcolor'].'<br>'; // green
              echo 'animal='.$_SES SION['animal'].'<br>'; // cat
              echo date('Y m d H:i:s', $_SESSION['time']);

              // You may want to use SID here, like we did in page1.php
              echo '<br /><a href="page1.php ">page 1</a>';
              ?>


              Below are my session variables from phpinfo(). I don't know enough about
              PHP yet to know if they're right or not.

              Directive Local Value Master Value
              session.auto_st art Off Off
              session.bug_com pat_42 Off Off
              session.bug_com pat_warn On On
              session.cache_e xpire 180 180
              session.cache_l imiter nocache nocache
              session.cookie_ domain no value no value
              session.cookie_ lifetime 0 0
              session.cookie_ path / /
              session.cookie_ secure Off Off
              session.entropy _file no value no value
              session.entropy _length 0 0
              session.gc_divi dend 1000 1000
              session.gc_maxl ifetime 1440 1440
              session.gc_prob ability 1 1
              session.name PHPSESSID PHPSESSID
              session.referer _check no value no value
              session.save_ha ndler files files
              session.save_pa th /tmp /tmp
              session.seriali ze_handler php php
              session.use_coo kies On On
              session.use_onl y_cookies Off Off
              session.use_tra ns_sid Off Off


              "Virgil Green" <vjg@obsydian.c om> wrote in message
              news:Iyahc.1918 8$L_7.2741@news svr22.news.prod igy.com...[color=blue]
              > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
              > news:c61m16$77c $1@titan.btinte rnet.com...[color=green][color=darkred]
              > > > Are you using session_start on every page? Are you certain your system[/color][/color]
              > is[color=green][color=darkred]
              > > > properly configured to store the sessions?[/color]
              > >
              > > I dunno how do I check?[/color]
              >
              > View the output of a phpinfo() function. Checll all the 'session.*'
              > properties. Does it match your system and the way you want sessions to be
              > processed? Also check the url_rewriter.ta gs property.
              >[color=green][color=darkred]
              > > > Are you registering your
              > > > variables with the session so they are available on the "next" page?[/color]
              > >
              > > I've got session_start() on each page if that's what you mean.[/color]
              >
              > No, as Phil said, you have to put the fields in the $_SESSION array or, if
              > you are using the older scheme, use the session_registe r() function for[/color]
              each[color=blue]
              > variable you want registered.
              >
              > Only registered variables (either method) will be retained across page
              > calls.
              >
              > - Virgil
              >
              >[/color]


              Comment

              • Virgil Green

                #8
                Re: Session_Start() Doesn't Work

                "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                news:c663se$nhp $1@titan.btinte rnet.com...[color=blue]
                >
                > Hello Again,
                >
                > Thanks for you replies. Yes I am using $_SESSION['favcolour']='blue'. In
                > fact I created page1.php and page2.php from the PHP documentation on
                > session_start() and it doesn't work for me either. My favcolour=green and
                > animal=cat on page1 but are blank on page2. I've got low security and
                > privacy settings and I've tried IE, Mozilla & Opera.
                >
                > Here's Page 1:
                >
                > <?php
                > // page1.php
                >
                > session_start() ;
                >
                > echo 'Welcome to page #1<br><br>';
                >
                > $_SESSION['favcolor'] = 'green';
                > $_SESSION['animal'] = 'cat';
                > $_SESSION['time'] = time();
                >
                > echo 'Session ID='.session_id ().'<br />';
                > echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                > echo 'animal='.$_SES SION['animal'];
                > // Works if session cookie was accepted
                > echo '<br /><a href="page2.php ">page 2</a>';
                >
                > // Or maybe pass along the session id, if needed
                > echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                > ?>
                >
                > Here's page 2.
                >
                > <?php
                > // page2.php
                >
                > session_start() ;
                >
                > echo 'Welcome to page #2<br /><br>';
                >
                > echo 'Session ID='.session_id ().'<br />';
                > echo 'favcolour='.$_ SESSION['favcolor'].'<br>'; // green
                > echo 'animal='.$_SES SION['animal'].'<br>'; // cat
                > echo date('Y m d H:i:s', $_SESSION['time']);
                >
                > // You may want to use SID here, like we did in page1.php
                > echo '<br /><a href="page1.php ">page 1</a>';
                > ?>[/color]

                This code worked for me, including the rewriting of the URL to include the
                session ID on the first pass (until the server knows if the cookie is
                accepted).

                I've noted the differences between your session settings and mine below.

                What does your URL look like the first time you click on the first page2
                link? Do that by starting the browser anew opening directly to the page1 and
                clicking the first page 2 link. What is the URL at that point? Mine is


                f39ae56f

                Is yours similar? You can test my version at
                www.obsydian.com/testing/page1.php and you can view my phpinfo at
                www.obsydian.com/test.php.
                [color=blue]
                > Below are my session variables from phpinfo(). I don't know enough about
                > PHP yet to know if they're right or not.
                >
                > Directive Local Value Master Value
                > session.auto_st art Off Off
                > session.bug_com pat_42 Off Off[/color]

                session.bug_com pat_42 On On
                [color=blue]
                > session.bug_com pat_warn On On
                > session.cache_e xpire 180 180
                > session.cache_l imiter nocache nocache
                > session.cookie_ domain no value no value
                > session.cookie_ lifetime 0 0
                > session.cookie_ path / /
                > session.cookie_ secure Off Off
                > session.entropy _file no value no value
                > session.entropy _length 0 0
                > session.gc_divi dend 1000 1000[/color]

                session.gc_divi sor 100 100
                [color=blue]
                > session.gc_maxl ifetime 1440 1440
                > session.gc_prob ability 1 1
                > session.name PHPSESSID PHPSESSID
                > session.referer _check no value no value
                > session.save_ha ndler files files
                > session.save_pa th /tmp /tmp
                > session.seriali ze_handler php php
                > session.use_coo kies On On
                > session.use_onl y_cookies Off Off
                > session.use_tra ns_sid Off Off[/color]

                session.use_tra ns_sid On On



                Comment

                • Chris Allen

                  #9
                  Re: Session_Start() Doesn't Work

                  Hi

                  Ah a bit of progress!!

                  Hmm it works fine from your site. At first I didn't get anything at the top
                  of the browser when I clicked on the first page2.php then I made the changes
                  you suggested in the php.ini file and now I get :



                  But my colour and animal are still blank on page2. Though now the session id
                  is being transfered.

                  Also I entered session.gc_divi sor = 100 but it doesn't appear in phpinfo().
                  Here's my phpinfo() now:

                  Session Support enabled
                  Registered save handlers files user

                  Directive Local Value Master Value
                  session.auto_st art Off Off
                  session.bug_com pat_42 On On
                  session.bug_com pat_warn On On
                  session.cache_e xpire 180 180
                  session.cache_l imiter nocache nocache
                  session.cookie_ domain no value no value
                  session.cookie_ lifetime 0 0
                  session.cookie_ path / /
                  session.cookie_ secure Off Off
                  session.entropy _file no value no value
                  session.entropy _length 0 0
                  session.gc_divi dend 1000 1000
                  session.gc_maxl ifetime 1440 1440
                  session.gc_prob ability 1 1
                  session.name PHPSESSID PHPSESSID
                  session.referer _check no value no value
                  session.save_ha ndler files files
                  session.save_pa th /tmp /tmp
                  session.seriali ze_handler php php
                  session.use_coo kies On On
                  session.use_onl y_cookies Off Off
                  session.use_tra ns_sid On On



                  "Virgil Green" <vjg@obsydian.c om> wrote in message
                  news:srxhc.328$ Ng3.235@newssvr 23.news.prodigy .com...[color=blue]
                  > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                  > news:c663se$nhp $1@titan.btinte rnet.com...[color=green]
                  > >
                  > > Hello Again,
                  > >
                  > > Thanks for you replies. Yes I am using $_SESSION['favcolour']='blue'. In
                  > > fact I created page1.php and page2.php from the PHP documentation on
                  > > session_start() and it doesn't work for me either. My favcolour=green[/color][/color]
                  and[color=blue][color=green]
                  > > animal=cat on page1 but are blank on page2. I've got low security and
                  > > privacy settings and I've tried IE, Mozilla & Opera.
                  > >
                  > > Here's Page 1:
                  > >
                  > > <?php
                  > > // page1.php
                  > >
                  > > session_start() ;
                  > >
                  > > echo 'Welcome to page #1<br><br>';
                  > >
                  > > $_SESSION['favcolor'] = 'green';
                  > > $_SESSION['animal'] = 'cat';
                  > > $_SESSION['time'] = time();
                  > >
                  > > echo 'Session ID='.session_id ().'<br />';
                  > > echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                  > > echo 'animal='.$_SES SION['animal'];
                  > > // Works if session cookie was accepted
                  > > echo '<br /><a href="page2.php ">page 2</a>';
                  > >
                  > > // Or maybe pass along the session id, if needed
                  > > echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                  > > ?>
                  > >
                  > > Here's page 2.
                  > >
                  > > <?php
                  > > // page2.php
                  > >
                  > > session_start() ;
                  > >
                  > > echo 'Welcome to page #2<br /><br>';
                  > >
                  > > echo 'Session ID='.session_id ().'<br />';
                  > > echo 'favcolour='.$_ SESSION['favcolor'].'<br>'; // green
                  > > echo 'animal='.$_SES SION['animal'].'<br>'; // cat
                  > > echo date('Y m d H:i:s', $_SESSION['time']);
                  > >
                  > > // You may want to use SID here, like we did in page1.php
                  > > echo '<br /><a href="page1.php ">page 1</a>';
                  > > ?>[/color]
                  >
                  > This code worked for me, including the rewriting of the URL to include the
                  > session ID on the first pass (until the server knows if the cookie is
                  > accepted).
                  >
                  > I've noted the differences between your session settings and mine below.
                  >
                  > What does your URL look like the first time you click on the first page2
                  > link? Do that by starting the browser anew opening directly to the page1[/color]
                  and[color=blue]
                  > clicking the first page 2 link. What is the URL at that point? Mine is
                  >
                  >[/color]
                  http://www.obsydian.com/testing/page...21d779a9b70bbf[color=blue]
                  > f39ae56f
                  >
                  > Is yours similar? You can test my version at
                  > www.obsydian.com/testing/page1.php and you can view my phpinfo at
                  > www.obsydian.com/test.php.
                  >[color=green]
                  > > Below are my session variables from phpinfo(). I don't know enough[/color][/color]
                  about[color=blue][color=green]
                  > > PHP yet to know if they're right or not.
                  > >
                  > > Directive Local Value Master Value
                  > > session.auto_st art Off Off
                  > > session.bug_com pat_42 Off Off[/color]
                  >
                  > session.bug_com pat_42 On On
                  >[color=green]
                  > > session.bug_com pat_warn On On
                  > > session.cache_e xpire 180 180
                  > > session.cache_l imiter nocache nocache
                  > > session.cookie_ domain no value no value
                  > > session.cookie_ lifetime 0 0
                  > > session.cookie_ path / /
                  > > session.cookie_ secure Off Off
                  > > session.entropy _file no value no value
                  > > session.entropy _length 0 0
                  > > session.gc_divi dend 1000 1000[/color]
                  >
                  > session.gc_divi sor 100 100
                  >[color=green]
                  > > session.gc_maxl ifetime 1440 1440
                  > > session.gc_prob ability 1 1
                  > > session.name PHPSESSID PHPSESSID
                  > > session.referer _check no value no value
                  > > session.save_ha ndler files files
                  > > session.save_pa th /tmp /tmp
                  > > session.seriali ze_handler php php
                  > > session.use_coo kies On On
                  > > session.use_onl y_cookies Off Off
                  > > session.use_tra ns_sid Off Off[/color]
                  >
                  > session.use_tra ns_sid On On
                  >
                  >
                  >[/color]


                  Comment

                  • Virgil Green

                    #10
                    Re: Session_Start() Doesn't Work


                    "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                    news:c66pt8$34h $1@hercules.bti nternet.com...[color=blue]
                    > Hi
                    >
                    > Ah a bit of progress!!
                    >
                    > Hmm it works fine from your site. At first I didn't get anything at the[/color]
                    top[color=blue]
                    > of the browser when I clicked on the first page2.php then I made the[/color]
                    changes[color=blue]
                    > you suggested in the php.ini file and now I get :
                    >
                    > http://sapphire/page2.php?PHPSESSID=...94c757977f9a6c
                    >
                    > But my colour and animal are still blank on page2. Though now the session[/color]
                    id[color=blue]
                    > is being transfered.[/color]

                    Make sure you have permissions to write t /tmp directory. Just a guess. I
                    don't know if you have all your error messages turned off or directed to a
                    log where they aren't being obvious.
                    [color=blue]
                    > Also I entered session.gc_divi sor = 100 but it doesn't appear in[/color]
                    phpinfo().

                    I don't know why i have a gc_divisor and you have a gc_dividend setting.
                    Perhaps different versions of PHP. I would suggest *not* adding gc_divisor
                    if you didn't already have it.

                    - Virgil


                    Comment

                    • Eric Stein

                      #11
                      Re: Session_Start() Doesn't Work

                      Try this:

                      session_start() ;
                      $var = "test";
                      session_registe r("var");

                      Later, pages can access it as $HTTP_SESSION_V ARS["var"].
                      ~Eric

                      My PGP public key: http://www.parabolagames.com/chem/pgppubkey.txt


                      "Virgil Green" <vjg@obsydian.c om> wrote in message
                      news:%iUhc.620$ _G4.594@newssvr 23.news.prodigy .com...[color=blue]
                      >
                      > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                      > news:c66pt8$34h $1@hercules.bti nternet.com...[color=green]
                      > > Hi
                      > >
                      > > Ah a bit of progress!!
                      > >
                      > > Hmm it works fine from your site. At first I didn't get anything at the[/color]
                      > top[color=green]
                      > > of the browser when I clicked on the first page2.php then I made the[/color]
                      > changes[color=green]
                      > > you suggested in the php.ini file and now I get :
                      > >
                      > > http://sapphire/page2.php?PHPSESSID=...94c757977f9a6c
                      > >
                      > > But my colour and animal are still blank on page2. Though now the[/color][/color]
                      session[color=blue]
                      > id[color=green]
                      > > is being transfered.[/color]
                      >
                      > Make sure you have permissions to write t /tmp directory. Just a guess. I
                      > don't know if you have all your error messages turned off or directed to a
                      > log where they aren't being obvious.
                      >[color=green]
                      > > Also I entered session.gc_divi sor = 100 but it doesn't appear in[/color]
                      > phpinfo().
                      >
                      > I don't know why i have a gc_divisor and you have a gc_dividend setting.
                      > Perhaps different versions of PHP. I would suggest *not* adding gc_divisor
                      > if you didn't already have it.
                      >
                      > - Virgil
                      >
                      >[/color]


                      Comment

                      • Chris Allen

                        #12
                        Re: Session_Start() Doesn't Work

                        Hi thanks for your suggestion but that didn't work either. I couldn't access
                        $HTTP_SESSION_V ARS["animal"] on the same page. Animal is blank.

                        Here's Page 1 now:

                        <?php
                        // page1.php

                        session_start() ;
                        $animal="cat";
                        session_registe r("animal");

                        echo 'Welcome To Page #1<br><br>';


                        $_SESSION['favcolor'] = 'green';

                        $_SESSION['time'] = time();

                        echo 'Session ID='.session_id ().'<br />';
                        echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                        echo 'animal='.$HTTP _SESSION_VARS["animal"];

                        // Works if session cookie was accepted
                        echo '<br /><a href="page2.php ">page 2</a>';

                        // Or maybe pass along the session id, if needed
                        echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                        ?>

                        "Eric Stein" <no@spam.com> wrote in message
                        news:c6i40u$8sr $1@news.wplus.n et...[color=blue]
                        > Try this:
                        >
                        > session_start() ;
                        > $var = "test";
                        > session_registe r("var");
                        >
                        > Later, pages can access it as $HTTP_SESSION_V ARS["var"].
                        > ~Eric
                        >
                        > My PGP public key: http://www.parabolagames.com/chem/pgppubkey.txt
                        >
                        >
                        > "Virgil Green" <vjg@obsydian.c om> wrote in message
                        > news:%iUhc.620$ _G4.594@newssvr 23.news.prodigy .com...[color=green]
                        > >
                        > > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                        > > news:c66pt8$34h $1@hercules.bti nternet.com...[color=darkred]
                        > > > Hi
                        > > >
                        > > > Ah a bit of progress!!
                        > > >
                        > > > Hmm it works fine from your site. At first I didn't get anything at[/color][/color][/color]
                        the[color=blue][color=green]
                        > > top[color=darkred]
                        > > > of the browser when I clicked on the first page2.php then I made the[/color]
                        > > changes[color=darkred]
                        > > > you suggested in the php.ini file and now I get :
                        > > >
                        > > > http://sapphire/page2.php?PHPSESSID=...94c757977f9a6c
                        > > >
                        > > > But my colour and animal are still blank on page2. Though now the[/color][/color]
                        > session[color=green]
                        > > id[color=darkred]
                        > > > is being transfered.[/color]
                        > >
                        > > Make sure you have permissions to write t /tmp directory. Just a guess.[/color][/color]
                        I[color=blue][color=green]
                        > > don't know if you have all your error messages turned off or directed to[/color][/color]
                        a[color=blue][color=green]
                        > > log where they aren't being obvious.
                        > >[color=darkred]
                        > > > Also I entered session.gc_divi sor = 100 but it doesn't appear in[/color]
                        > > phpinfo().
                        > >
                        > > I don't know why i have a gc_divisor and you have a gc_dividend setting.
                        > > Perhaps different versions of PHP. I would suggest *not* adding[/color][/color]
                        gc_divisor[color=blue][color=green]
                        > > if you didn't already have it.
                        > >
                        > > - Virgil
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • Virgil Green

                          #13
                          Re: Session_Start() Doesn't Work

                          "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                          news:c6l697$21g $1@titan.btinte rnet.com...[color=blue]
                          > Hi thanks for your suggestion but that didn't work either. I couldn't[/color]
                          access[color=blue]
                          > $HTTP_SESSION_V ARS["animal"] on the same page. Animal is blank.
                          >
                          > Here's Page 1 now:
                          >
                          > <?php
                          > // page1.php
                          >
                          > session_start() ;
                          > $animal="cat";
                          > session_registe r("animal");
                          >
                          > echo 'Welcome To Page #1<br><br>';
                          >
                          >
                          > $_SESSION['favcolor'] = 'green';
                          >
                          > $_SESSION['time'] = time();
                          >
                          > echo 'Session ID='.session_id ().'<br />';
                          > echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                          > echo 'animal='.$HTTP _SESSION_VARS["animal"];
                          >
                          > // Works if session cookie was accepted
                          > echo '<br /><a href="page2.php ">page 2</a>';
                          >
                          > // Or maybe pass along the session id, if needed
                          > echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                          > ?>
                          >[/color]

                          Too weird. It must be in your configuration somewhere. The code I posted
                          back to you earlier works just fine on my server. Can you provide a link to
                          a full phpinfo() function?

                          - Virgil


                          Comment

                          • Chris Allen

                            #14
                            Re: Session_Start() Doesn't Work

                            Hi,

                            I'm afraid I can't as it's a local server not connected to the internet. I
                            think I'm going re-install it all.
                            Thanks very much for all your efforts. I've a learnt quite a bit because of
                            it.

                            Chris

                            "Virgil Green" <vjg@obsydian.c om> wrote in message
                            news:h5ujc.2537 $M%5.1025@newss vr23.news.prodi gy.com...[color=blue]
                            > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                            > news:c6l697$21g $1@titan.btinte rnet.com...[color=green]
                            > > Hi thanks for your suggestion but that didn't work either. I couldn't[/color]
                            > access[color=green]
                            > > $HTTP_SESSION_V ARS["animal"] on the same page. Animal is blank.
                            > >
                            > > Here's Page 1 now:
                            > >
                            > > <?php
                            > > // page1.php
                            > >
                            > > session_start() ;
                            > > $animal="cat";
                            > > session_registe r("animal");
                            > >
                            > > echo 'Welcome To Page #1<br><br>';
                            > >
                            > >
                            > > $_SESSION['favcolor'] = 'green';
                            > >
                            > > $_SESSION['time'] = time();
                            > >
                            > > echo 'Session ID='.session_id ().'<br />';
                            > > echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                            > > echo 'animal='.$HTTP _SESSION_VARS["animal"];
                            > >
                            > > // Works if session cookie was accepted
                            > > echo '<br /><a href="page2.php ">page 2</a>';
                            > >
                            > > // Or maybe pass along the session id, if needed
                            > > echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                            > > ?>
                            > >[/color]
                            >
                            > Too weird. It must be in your configuration somewhere. The code I posted
                            > back to you earlier works just fine on my server. Can you provide a link[/color]
                            to[color=blue]
                            > a full phpinfo() function?
                            >
                            > - Virgil
                            >
                            >[/color]


                            Comment

                            • Chris Allen

                              #15
                              Re: Session_Start() Doesn't Work

                              Hey Guess What !!???

                              I removed PHP and Apache and upgraded to Apache 2 and upgraded to PHP 4.3.6
                              and the same f*%#***ng thing is still happening!!
                              It's got to be something to do with Windows.


                              "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                              news:c6qqnj$t43 $1@titan.btinte rnet.com...[color=blue]
                              > Hi,
                              >
                              > I'm afraid I can't as it's a local server not connected to the internet. I
                              > think I'm going re-install it all.
                              > Thanks very much for all your efforts. I've a learnt quite a bit because[/color]
                              of[color=blue]
                              > it.
                              >
                              > Chris
                              >
                              > "Virgil Green" <vjg@obsydian.c om> wrote in message
                              > news:h5ujc.2537 $M%5.1025@newss vr23.news.prodi gy.com...[color=green]
                              > > "Chris Allen" <c.allen@nospam .co.uk> wrote in message
                              > > news:c6l697$21g $1@titan.btinte rnet.com...[color=darkred]
                              > > > Hi thanks for your suggestion but that didn't work either. I couldn't[/color]
                              > > access[color=darkred]
                              > > > $HTTP_SESSION_V ARS["animal"] on the same page. Animal is blank.
                              > > >
                              > > > Here's Page 1 now:
                              > > >
                              > > > <?php
                              > > > // page1.php
                              > > >
                              > > > session_start() ;
                              > > > $animal="cat";
                              > > > session_registe r("animal");
                              > > >
                              > > > echo 'Welcome To Page #1<br><br>';
                              > > >
                              > > >
                              > > > $_SESSION['favcolor'] = 'green';
                              > > >
                              > > > $_SESSION['time'] = time();
                              > > >
                              > > > echo 'Session ID='.session_id ().'<br />';
                              > > > echo 'favcolor='.$_S ESSION['favcolor'].'<br>';
                              > > > echo 'animal='.$HTTP _SESSION_VARS["animal"];
                              > > >
                              > > > // Works if session cookie was accepted
                              > > > echo '<br /><a href="page2.php ">page 2</a>';
                              > > >
                              > > > // Or maybe pass along the session id, if needed
                              > > > echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
                              > > > ?>
                              > > >[/color]
                              > >
                              > > Too weird. It must be in your configuration somewhere. The code I posted
                              > > back to you earlier works just fine on my server. Can you provide a link[/color]
                              > to[color=green]
                              > > a full phpinfo() function?
                              > >
                              > > - Virgil
                              > >
                              > >[/color]
                              >
                              >[/color]


                              Comment

                              Working...