Session is not available in different browser

Discussion in 'PHP' started by deecee2000, Aug 17, 2009.

  1. #1
    My code:

    File1.php
    <?php
    session_start();
    $_SESSION['name'] = 'ABC';
    ?>

    File2.php
    <?php
    session_start();
    if(isset($_SESSION['name'])
    {
    echo "Session Set";
    }
    else
    {
    echo "Session not Set";
    }
    ?>

    When I try to run first file "file1.php" and then "file2.php" in Firefox, session value showing correctly at file2.php
    But then if I try "file2.php" in IE the session value is not showing there.

    How can I fix this issue.

    Any help would appreciated.
    Thanks in Advance.
     
    deecee2000, Aug 17, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why should it be?

    Sessions are not based strictly on IP addresses but actual session of usage, essentially that would mean someone at a public hotspot could log onto your account from their own machine.

    Anywho its better that way and most people tend to stick with one browser unless a site presents them a problem. (A method of session management is tracked based on a session ID in a cookie, cookies are not stored cross-browser for security reasons)
     
    Last edited: Aug 17, 2009
    kblessinggr, Aug 17, 2009 IP
  3. shaunole

    shaunole Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's not entirely true. Sessions in PHP usually have a cookie stored identifying the active session for a browser. The session will not exist from one browser to another, however, another user should not be able to login as you without having that cookie or your session id and IP address.

    Hope this helps.

    Shaun Oleson
    blog.olebox.com
     
    shaunole, Aug 17, 2009 IP