session variables 'disappear'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ruben van Engelenburg

    session variables 'disappear'

    Hi all,

    I have a strange problem. I have a login procedure that uses a mysql
    database in which the users are stored.
    The login procedure is pretty straightforward . In every page I unclude
    my session.php.

    session.php:

    =============

    session_start() ;

    // if username and password were specified, fetch them
    if (isset($HTTP_PO ST_VARS['username'])) $entered_userna me =
    $HTTP_POST_VARS['username'];
    if (isset($HTTP_PO ST_VARS['password'])) $entered_passwo rd =
    $HTTP_POST_VARS['password'];

    // check if login is neccesary
    if (!isset($entere d_username) && !isset($entered _password))
    {
    // use data from session
    if (isset($_SESSIO N['username']))
    {
    $login = $_SESSION['username'];
    $password = $_SESSION['password'];
    }
    else
    {
    // Display error cause we don't have a username
    $_SESSION['message'] = $MsgErrAccessDe nied;
    require("./error.php");
    exit;
    }
    }
    else
    {
    // use entered data

    // encrypt entered password
    $login = $entered_userna me;
    $password = md5($entered_pa ssword);

    $_SESSION['username'] = $login;
    $_SESSION['password'] = $password;
    }

    <More code>
    ============

    On one server this works fine. On another one though the session
    variables $_SESSION['username'] and $_SESSION['password'] aren't being
    stored. I can tell by looking at the session_.... file in /tmp.
    On the server where it works it contains the username and password
    session vars, on the server where it doesn't work the file is being
    created but it's empty. I checked php.ini, comparing the php.ini files
    from both servers, especially the settings that have to do with
    sessions. Both have the same session settings, but the problem still exists:

    session.save_ha ndler = files

    session.save_pa th = /tmp

    session.use_coo kies = 1

    session.name = PHPSESSID

    session.auto_st art = 1

    session.cookie_ lifetime = 0

    session.cookie_ path = /

    session.cookie_ domain =

    session.seriali ze_handler = php

    session.gc_prob ability = 1

    session.gc_maxl ifetime = 1440

    session.referer _check =

    session.entropy _length = 0

    session.entropy _file =

    session.cache_l imiter = nocache

    session.cache_e xpire = 180

    session.use_tra ns_sid = 1

    System specs:
    =============

    Server that works : Solaris 8 intel, Apache 1.3.26, PHP 4.2.2

    Server that doesn't work : Linux 2.4.16 (Sun Cobalt), Apache 1.3.20, PHP
    4.0.6

    Any ideas are welcome.

    Kind regards,
    Ruben.

  • Ruben van Engelenburg

    #2
    Re: session variables 'disappear'

    [snip original posting]

    Never mind, I resolved it by upgrading to PHP 4.3.3. I still don't know
    the reason of the original problem, but it works anyways now.

    Ruben.

    Comment

    • Matthias Esken

      #3
      Re: session variables 'disappear'

      Ruben van Engelenburg <ruben@NOSPAMte xtinfo.nl> schrieb:
      [color=blue]
      > On one server this works fine. On another one though the session
      > variables $_SESSION['username'] and $_SESSION['password'] aren't being
      > stored.
      > [...]
      > Server that doesn't work : Linux 2.4.16 (Sun Cobalt), Apache 1.3.20, PHP
      > 4.0.6[/color]

      The superglobal $_SESSION does not exist in 4.0.6.

      http://www.php.net/manual/en/languag...predefined.php will give
      you more information.

      Regards,
      Matthias

      Comment

      • Ruben van Engelenburg

        #4
        Re: session variables 'disappear'

        Matthias Esken wrote:
        [color=blue]
        > The superglobal $_SESSION does not exist in 4.0.6.
        >
        > http://www.php.net/manual/en/languag...predefined.php will give
        > you more information.[/color]

        Makes sense indeed. It worked after I upgraded to 4.3.3. Thanks for the
        info.

        Regards,
        Ruben.

        Comment

        • Michael W. Cocke

          #5
          Re: session variables 'disappear'

          On Thu, 11 Sep 2003 01:53:23 +0200, Ruben van Engelenburg
          <ruben@NOSPAMte xtinfo.nl> wrote:
          [color=blue]
          >Matthias Esken wrote:
          >[color=green]
          >> The superglobal $_SESSION does not exist in 4.0.6.
          >>
          >> http://www.php.net/manual/en/languag...predefined.php will give
          >> you more information.[/color]
          >
          >Makes sense indeed. It worked after I upgraded to 4.3.3. Thanks for the
          >info.
          >
          >Regards,
          >Ruben.[/color]

          Slight change of subject, but only slight - does anyone know when the
          PHP developers are going to stop screwing around with variables? I've
          had to rewrite the same [expletive deleted] application 3 times now
          because they can't leave anything alone! Once more and I recode it in
          perl and burn my php manuals.

          Mike-

          Mornings: Evolution in action. Only the grumpy will survive.
          -----------------------------------------------------

          Please note - Due to the intense volume of spam, we have
          installed site-wide spam filters at catherders.com. If
          email from you bounces, try non-HTML, non-encoded,
          non-attachments.


          ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
          http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
          ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

          Comment

          • Matthias Esken

            #6
            Re: session variables 'disappear'

            Michael W. Cocke <cocke@catherde rs.com> schrieb:
            [color=blue]
            > Slight change of subject, but only slight - does anyone know when the
            > PHP developers are going to stop screwing around with variables? I've
            > had to rewrite the same [expletive deleted] application 3 times now
            > because they can't leave anything alone![/color]

            What was the problem? If your code relies on register_global s, then you
            can reactivate them.

            Regards,
            Matthias

            Comment

            • Michael W. Cocke

              #7
              Re: session variables 'disappear'

              On Thu, 11 Sep 2003 18:33:04 +0200, Matthias Esken
              <muelleimer2003 @usenetverwaltu ng.org> wrote:
              [color=blue]
              >Michael W. Cocke <cocke@catherde rs.com> schrieb:
              >[color=green]
              >> Slight change of subject, but only slight - does anyone know when the
              >> PHP developers are going to stop screwing around with variables? I've
              >> had to rewrite the same [expletive deleted] application 3 times now
              >> because they can't leave anything alone![/color]
              >
              >What was the problem? If your code relies on register_global s, then you
              >can reactivate them.
              >
              >Regards,
              > Matthias[/color]

              Register globals was the second rewrite, and I couldn't just turn it
              on because that busted another app I use. I honestly don't know what
              the current problem is, but re-writing everything to use method=post
              solved it. Every time the php module is updated, I have to go
              recode... it's getting really old.

              Mike-

              Mornings: Evolution in action. Only the grumpy will survive.
              -----------------------------------------------------

              Please note - Due to the intense volume of spam, we have
              installed site-wide spam filters at catherders.com. If
              email from you bounces, try non-HTML, non-encoded,
              non-attachments.


              ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
              http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
              ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

              Comment

              Working...