CodeIgniter Forums
Session Wont Set on IE7 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session Wont Set on IE7 (/showthread.php?tid=8276)

Pages: 1 2 3


Session Wont Set on IE7 - El Forum - 05-12-2008

[eluser]Popcorn[/eluser]
A session variable wont be set with IE7 if the session cookie name has an underscore in it.

This is a strange bug, at first I was thought to of believed it was a server side issue (clock out of sync). The tech support however did a test and it worked fine for them.

There are mixed results from different people. It's very hard to get a definite answer.

Code:
function login ($email, $password)
    {
        $result = $this->_get_hash($this->users_table, $email); // Grab hash, password, and id from database.

        if ($result) // Result Found
        {
            $password = sha1(sha1($this->salt.$result->hash.$password)); // Hash input password

            if ($password === $result->password) // Passwords match?
            {
                $this->ci->session->set_userdata(array('id'=> $result->id));

                return true;
            }
        }
        
        return false;
    }

Then check login with

Code:
function logged_in ()
    {
        return $var = ($this->ci->session->userdata('id')) ? true : false;
    }

It worked locally for me. Then on the remote server it didn't, but worked for the server tech over there.

I removed the underscore and it worked perfect. Stumped!


Session Wont Set on IE7 - El Forum - 05-12-2008

[eluser]Derek Allard[/eluser]
I have to admit I'm lost. What underscore? The only session I can see you've set has a key of "id".

Can you recreate with this
Code:
<?php

class Test extends Controller {

    function __construct()
    {
        parent::Controller();
        $this->load->library('session');
    }

    function index()
    {
        $this->load->helper('url'); // this is just for the anchor() function
        
        $this->session->set_userdata('some_name', 'some_value');
        
        echo anchor('test/set_it_and_forget_it', 'go read the session');
    }
    
    function set_it_and_forget_it()
    {
        echo "your session is: ";
        echo $this->session->userdata('some_name');    
    }

}
?>



Session Wont Set on IE7 - El Forum - 05-12-2008

[eluser]wiredesignz[/eluser]
I have a similar issue with IE7 where I cannot login a second time after a session cookie has expired. The old cookie is still visible in temporary internet files, and I'm wondering if the login code sees the expired session cookie before managing login and then fails to refresh the cookie.

Manually deleting the cookies allows login to work again. But if I don't actually logout the cookie is not deleted.

I haven't investigated this as yet, but if I find something I'll post back.


Session Wont Set on IE7 - El Forum - 05-13-2008

[eluser]Popcorn[/eluser]
Derek Allard : $config['sess_cookie_name']= 'ci_session';

http://leveldesign.info/redux/index.php/test

It's really odd. It's worked for some people, then not others


Session Wont Set on IE7 - El Forum - 05-13-2008

[eluser]wiredesignz[/eluser]
Your test site in XP/IE7 worked on the first visit, but once I closed the browser and re-opened in a new window the test fails, ie: no session data is saved.

I also notice there are two cookies from the site in temporary internet files:
Cookie:[email protected]/
Cookie:[email protected]/

This could be an issue.

EDIT:
Deleting the www.leveldesign.info/ cookie fixed the problem, it does not return and all visits in new browser windows work properly.

The other cookie is updated properly.

This problem does not occur in FF


Session Wont Set on IE7 - El Forum - 05-13-2008

[eluser]wiredesignz[/eluser]
Also found this at php.net/setcookie
Quote:IE7 will not delete a cookie value if the time is set to the past. It will hold the value no matter how far in the past you set the "expire" value.



Session Wont Set on IE7 - El Forum - 05-13-2008

[eluser]Pascal Kriete[/eluser]
I haven't laughed this hard in a long time. Of all the browsers to mess it up, it had to be IE again.


Session Wont Set on IE7 - El Forum - 05-13-2008

[eluser]wiredesignz[/eluser]
Just another day in the life of the web developer, inparo. Tongue


Session Wont Set on IE7 - El Forum - 09-15-2008

[eluser]Derek Jones[/eluser]
I posted this on another thread, but it's relevant here as well.

The solution of removing the underscore is troubling to be since it would seem to not be the actual issue. I say that because some of the highest traffic sites on the internet that cater to the IE crowd (Amazon, CNN, ESPN, Microsoft's own site, etc.) use underscores in cookie names just fine, so that's obviously not the actual issue. I wouldn't discount that it's somehow corollary, but it is not causative (using an underscore in a cookie name in general).


Session Wont Set on IE7 - El Forum - 10-09-2009

[eluser]bd3521[/eluser]
[quote author="Derek Jones" date="1221520539"]I posted this on another thread, but it's relevant here as well.

The solution of removing the underscore is troubling to be since it would seem to not be the actual issue. I say that because some of the highest traffic sites on the internet that cater to the IE crowd (Amazon, CNN, ESPN, Microsoft's own site, etc.) use underscores in cookie names just fine, so that's obviously not the actual issue. I wouldn't discount that it's somehow corollary, but it is not causative (using an underscore in a cookie name in general).[/quote]So what could it be?