Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: On sessions...

  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    Ghent, Belgium
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question On sessions...

    The php manual is not too clear on sessions, and after tinkering with it, I still have some questions:
    [list=a][*]Does a session_start() look for previous sessions on the users computer (ie cookies)?[*]In order to initialize a session variable (say: $_SESSION["Admin"] = False) each time a user visits a page for the first time, do I have to call session_unset()?[*]I started a page with session_start(), but echo SID returns an empty string. How comes?[/list=a]

    I thought session variables had to be passed on "manually", either via cookies or via the URL. It seems as if PHP decides for itself whether to keep the values inside a session variable.
    Last edited by LaundroMat; 03-12-2003 at 09:01 PM.
    Those innocent fun games of the hallucination generation

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    session_start sort of looks for a client cookie
    in reality the client cookie data is sent with the http request for the page - so session_start really only assigns the data to $_SESSION variables ready for the script to access.

    check your phpinfo() and find out what the session id name is - it might well be something different to SID (there are numerous variants)

    you shouldn't need session_unset - as $_SESSION['admin'] = false; would overwrite any existing value of the session var 'admin'
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    Ghent, Belgium
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Aha! Thanks. All has been fixed now
    Those innocent fun games of the hallucination generation


  •  

    Posting Permissions

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