SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: Sessions :(

Hybrid View

  1. #1
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Sessions :(

    I have a site that is working fine on localhost and then when i upload it, it doesn't work the session data is lost.

    I am running windows here and linux on the host.

    Any idea what may be the cause of this problem. I am using session_start() and session_register() commands thanks
    Garlic bread, I've tasted it, it's the future

  2. #2
    Action! filmfoto's Avatar
    Join Date
    Dec 2001
    Location
    Sweden
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does this server have session support enable? Call phpinfo() in a script and check for the session section. Does it say "Session Support: enabled"?




    Cheers.

  3. #3
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here is the script http://www.f1universe.com/phpinfo/

    it is enabled
    Garlic bread, I've tasted it, it's the future

  4. #4
    Action! filmfoto's Avatar
    Join Date
    Dec 2001
    Location
    Sweden
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very strange, all seems correct. Will have to do some research and get back to you.




    Cheers.

  5. #5
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just use session_start(); on every page right once i have registered the session with session_register('blah','blah2') . This is how i did it on my windows setup and worked fine as soon as i upload

    On a second note netscape 6 tries to download the PHP file when you click the button on the form. Did i do something wrong here?
    Garlic bread, I've tasted it, it's the future

  6. #6
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is an update if i do the following

    Login
    The username is kept in the session perfectly
    Go back to the main page
    Login
    The username is kept in the session perfectly
    Go back to the main page
    Login
    The username is kept in the session perfectly
    Go back to the main page
    Login
    The session is blank

    Hmm very strange. Closing the browser and then revisiting the site then it works again.
    Garlic bread, I've tasted it, it's the future

  7. #7
    Action! filmfoto's Avatar
    Join Date
    Dec 2001
    Location
    Sweden
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean that your sessions work, but only sporadically? Also you should call session_start() first on every page and then use session_register.





    Cheers.

  8. #8
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There a bit hit and miss but only when using IE. Maybe it is a setting here. I only use Session_start() on each page should i use session_register() to?
    Garlic bread, I've tasted it, it's the future

  9. #9
    Action! filmfoto's Avatar
    Join Date
    Dec 2001
    Location
    Sweden
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    session_register() is used if you want a variable value to be passed from page to page.

    Example:
    PHP Code:
    session_start();
    $user "Testuser";
    session_register("user"); 

    This will make the variable $user available on every page where a session has started.
    About the hit and miss with IE, no luck in finding a solution yet.




    Cheers.

  10. #10
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use session_register('userid','username','password') on the login script and then from there on i use session_start() on each page. I didn't think i had to re register the whole session again?

    Thanks for your help so far
    Garlic bread, I've tasted it, it's the future

  11. #11
    Action! filmfoto's Avatar
    Join Date
    Dec 2001
    Location
    Sweden
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wasn't to clear, sorry.

    No need to re register the variables, but you should access the variables like this to see if they are set properly:

    PHP Code:
    if (session_is_registered("user")) {
        
    /* do your code here */



    Cheers.

  12. #12
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool it seems though that once the session data is lsot they can not be reset until the broswer is closed and reloaded.

    Just to add to this i just found that it works fine in netcaptor which is really just IE. This is really strange. I was wondering f it could have anything to do with p3p? (is that whats its called?) lol
    Garlic bread, I've tasted it, it's the future


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
  •