I am having problems with sessions.

Discussion in 'PHP' started by assgar, Sep 25, 2008.

  1. #1
    Hi


    When using Internet Explorer I can pass sessions to other pages.
    I cannot pass sessions when I use Mozilla Firefox.

    
    //at the top of the page
    session_start();
    
    //value passed
    $last_login = $_SESSION['s_last_login'];//last user login history
    
    PHP:

    
    //This is my PHP.ini file session configuration below.
    
    [Session]
    ; Handler used to store/retrieve data.
    session.save_handler = files
    ;session.save_path = "N;/path"
    ;session.save_path = "N;MODE;/path"
    ;session.save_path = "/tmp"
    session.use_cookies = 1
    session.name = PHPSESSID
    ;Initialize session on request startup.
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /
    session.cookie_domain =
    session.serialize_handler = php
    session.gc_probability = 1
    session.gc_divisor     = 100
    session.gc_maxlifetime = 1440
    session.bug_compat_42 = 1
    session.bug_compat_warn = 1
    session.referer_check =
    session.entropy_length = 0
    session.entropy_file =
    ;session.entropy_length = 16
    ;session.entropy_file = /dev/urandom
    session.cache_limiter = nocache
    session.cache_expire = 180
    session.use_trans_sid = 0
    session.hash_function = 0
    session.hash_bits_per_character = 4
    
    PHP:

     
    assgar, Sep 25, 2008 IP
  2. linkexchange1984

    linkexchange1984 Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    linkexchange1984, Sep 25, 2008 IP
  3. hamidof

    hamidof Peon

    Messages:
    619
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Does that Firefox accept cookies?
     
    hamidof, Sep 25, 2008 IP
  4. wisdomtool

    wisdomtool Moderator Staff

    Messages:
    15,826
    Likes Received:
    1,367
    Best Answers:
    1
    Trophy Points:
    455
    #4
    Is yours a linux or windows php installation? This has to do more with the sessiondata folder permission, check the permissions setting there. I think for linux it is 777 correct me if I am wrong. I am more familiar with Windows which should be iuser read write.
     
    wisdomtool, Sep 25, 2008 IP
  5. hamidof

    hamidof Peon

    Messages:
    619
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    When it's working on one browser and not working with the other, I would check and see if the other one has cookies enabled...
     
    hamidof, Sep 25, 2008 IP
  6. chriseccles2

    chriseccles2 Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    linkexchange1984 will probably shoot this down in flames but,
    wouldn't it be preferable to embed the SID in a hidden form field
    when constructing any returned HTML, to ensure compatibility
    with browsers which either do not recognise cookies, or within
    which the user has disabled accepting cookies ?
    -
    This has the advantage that the SID does not flash (however briefly)
    in the user's browser address line when responding with a submit.
    -
    $_POST would then include a reference to the SID, which would be
    some kind of catch-all, circumventing the cookie issue ?

    -
    Chris
     
    chriseccles2, Sep 25, 2008 IP
  7. assgar

    assgar Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for the solutions\sugestion.

    This is a windows 2003 server php installaion using Apache.

    Enabling cookie was the temporary solution.
    I will store the session info in a database.

    How do I accomplish the example below if I disable cookies?

    example:
    I have a 20 pages I need to pass the same user preferences\permissions\data across. I have been using sessions in IE and it works. I want to move to Firefox.
    Note: The total of 15 to 20 preferences\permissions\data are stored in mysql DB and security is important.

    I would prefer not to have to select the preferences\permissions\data from the database for each page.
     
    assgar, Sep 27, 2008 IP
  8. conductr

    conductr Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    if the session is set when using IE and you want to open up FF and expect it to load the IE session, that will not work

    well, maybe if you wanted to bring the session ID over to FF with you. you would have to tell the script the session ID, and try to load it. But, I think PHP is designed to not offer that functionality because it is a huge security hole. (if some dummy links to their banks page, and the session id is in the URL, all you have to do is copy/paste to get into their account).
     
    conductr, Sep 28, 2008 IP