basic session question

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

    basic session question

    All,
    I've read the docs on session handling but still can't figure this one
    out. I'm guessing it's a setting in php.ini or something.
    I've inherited this code from someone, and it's got a typical login/set
    session/redirect. on the live server, it works fine. on my local computer,
    it doesn't.

    in the login script, the session is being created correctly, as print_r()
    shows me. but when it redirects to the next page, I get "Undefined variable:
    _SESSION" when i do a print_r on it. I've added session_start() to that
    page, but then all I get is an empty session array.

    Here's the pertinent chunk of code i inherited in the login page:

    // Start the session, register the values & redirect.
    session_name ('YourVisitID') ;
    //ini_set ('session.use_c ookies', 0);
    session_start() ;
    $_SESSION['first_name'] = $row[1];
    $_SESSION['user_id'] = $row[0];
    print_r($_SESSI ON);
    //exit();
    header ("Location: http://" . $root . "/photogallery/admin.php?" .
    SID);
    exit();


    Any of this sound like a familiar problem?

    Thanks a lot.

    Marc


  • Marc E

    #2
    Re: basic session question

    figured this one out. it was that YourVisitID. I didn't see any calls to
    session_start() on any of this dude's other pages, but the docs told me i
    needed it so i started putting them in, but it didn't fix it. once i got
    rid of that session_name() call, things started working. now i understand
    what's going on.




    "Marc E" <noexist@hifiwe bdesign.comwrot e in message
    news:ec2dncekr--VWDfYnZ2dnUVZ_t mknZ2d@suscom.c om...
    All,
    I've read the docs on session handling but still can't figure this one
    out. I'm guessing it's a setting in php.ini or something.
    I've inherited this code from someone, and it's got a typical login/set
    session/redirect. on the live server, it works fine. on my local computer,
    it doesn't.
    >
    in the login script, the session is being created correctly, as print_r()
    shows me. but when it redirects to the next page, I get "Undefined
    variable: _SESSION" when i do a print_r on it. I've added session_start()
    to that page, but then all I get is an empty session array.
    >
    Here's the pertinent chunk of code i inherited in the login page:
    >
    // Start the session, register the values & redirect.
    session_name ('YourVisitID') ;
    //ini_set ('session.use_c ookies', 0);
    session_start() ;
    $_SESSION['first_name'] = $row[1];
    $_SESSION['user_id'] = $row[0];
    print_r($_SESSI ON);
    //exit();
    header ("Location: http://" . $root . "/photogallery/admin.php?" .
    SID);
    exit();
    >
    >
    Any of this sound like a familiar problem?
    >
    Thanks a lot.
    >
    Marc
    >

    Comment

    Working...