SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session Across Multiple Directories

    Hi

    I have a problem where session variables are not being sent across different directories. I've searched around, looked at the manuals, but just can't figure this one out. Here's what I've got...

    example.com/login.php

    This has a log in form, which, when submitted, checks the login info in MySQL then sets up a bunch of stuff about the user, e.g....

    $_SESSION['userId'] = 1;
    $_SESSION['name'] = 'whatever';

    Then redirects via...

    header('Location: http://www.example.com/members');

    When I get to the member directory the session is dead. Echoing session_id() shows that there is no session id. Is this a php_ini problem? Or is it something else?

    I am using this inside a frameset and only one frame is redirecting the rest are static, if that is of any consequance.

    Thx in advance.

  2. #2
    SitePoint Addict sleepingdanny's Avatar
    Join Date
    Oct 2002
    Location
    Israel
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try adding SID to the URL.

    PHP Code:
    header("Location: [url="http://www.example.com/members/index.php'%20.%20SID"]http://www.example.com/members/index.php' . SID[/url] . '"); 
    - Danny


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •