SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: php session ie6

  1. #1
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php session ie6

    Hi all,

    Ok.. there seems to be a bit of problems with sessions and IE6, and I'm unclear what this is or how to fix it. Basically a person can't log in to my script, or is being logged out prematurely (ie, session ended). I'm unsure why. The code works great in every browser, except IE6. Has anyone else had some strange behaviors, or how to fix this?

    PHP Code:
        if (mysql_num_rows($result) == 1) {
        
            
    // see if user wishes info to be stored in cookie
            
    if ($_POST["remember"] == 1) {
            
                
    // user wants cookies, set cookies
                
    setcookie("level"$row_result["admin_access"], time()+60*60*24*4);
                
    setcookie("email"$row_result["email"], time()+60*60*24*4);
                
    setcookie("username"$row_result["username"], time()+60*60*24*4);
                
    setcookie("id"$row_result["id"], time()+60*60*24*4);
                
    setcookie("first_name"$row_result["first_name"], time()+60*60*24*4);        
                
    $content .= "<p>setting cookie</p>";
                
            } else {
            
                
    // no cookies, use sessions
                
    $_SESSION["level"] = $row_result["admin_access"];
                
    $_SESSION["email"] = $row_result["email"];
                
    $_SESSION["username"] = $row_result["username"];
                
    $_SESSION["id"] = $row_result["id"];
                
    $_SESSION["first_name"] = $row_result["first_name"];
            }
            
    header("Location: member.php"); /* Redirect browser */ 

  2. #2
    SitePoint Evangelist klik's Avatar
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    547
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code which you have posted looks fine. Where are you checking to see if the cookie/session is set?

  3. #3
    011110010110000101111001 jabird's Avatar
    Join Date
    Aug 2004
    Location
    U.S.
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This was in a piece of code a user here at sitepoint gave me:

    PHP Code:
    //IE 6 Fix
    header ("Cache-control: private") ; 
    Don't know if thats what you need though... try it out.
    ~Jabird
    Jabird.com
    If I were binary... I'd be all 1's for you.
    BBCode trouble?

  4. #4
    Resistance is Futile webgodjj's Avatar
    Join Date
    Nov 2002
    Location
    Madison, WI USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    session_start();
    if (!$_SESSION["id"]) {
    header("Location: index.php"); /* Redirect browser */
    }

  5. #5
    SitePoint Evangelist klik's Avatar
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    547
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But if they have chosen to be remembered they have no session set - only a cookie, am I correct?

    If so, you will have to adapt your code to state if cookie does not exist and session id does not exist.


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
  •