Welcome Guest, Not a member yet? Register   Sign In
Sessions not working in IE 7
#1

[eluser]spider pig[/eluser]
I am working on a backend of a site. The login uses CI sessions and works fine in Safari, Firefox and IE 6 but not IE 7. Here's the code that verifies the user and sets the session variables. Session is set to autoload.

Code:
function submit() {
    $this->main->load_settings();

    // Verify Data
    $errorMessage = NULL;
    if ($_POST['username'] == NULL)
        $errorMessage = 'Your Username is required.<br />';
    if ($_POST['password'] == NULL)
        $errorMessage .= 'Your Password is required.<br />';
    if ($_POST['username'] != NULL and $_POST['password'] != NULL) {
        $query = $this->db->get_where('admin_user', array('userUsername' => $_POST['username'], 'userPassword' => md5($_POST['password'])));
        if ($query->num_rows() == 0) {
            $errorMessage .= 'The Username or Password is incorrect.<br />';
        } else {
            $row = $query->row();
            if ($row->userStatus != 'Active')
                $errorMessage .= 'Your account has been de-activated.<br />';
        }
    }
    if ($errorMessage != NULL) {
        // re-display login form
        return;
    }

    $this->session->set_userdata('userID', $row->userID);
    $this->session->set_userdata('userGroup', $row->userGroup);

    $this->load->helper('url');
    redirect('main_menu', 'refresh');
}

This function is called a to check if the person is logged in:

Code:
function check() {
    $data = array('userID' => $this->session->userdata('userID'),
            'userGroup' => $this->session->userdata('userGroup')
        );
    $query = $this->db->get_where('admin_user', $data);
    if ($query->num_rows() == 0) {
        echo $this->load->view('redirect', NULL, TRUE);
        return FALSE;
    }
    return TRUE;
}

These are the session settings:

Code:
$config['encryption_key'] = "apassword";

$config['sess_cookie_name']    = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']         = 300;

Is there a way to fix the problem with IE 7?

Thanks
#2

[eluser]Sumon[/eluser]
did you clear the cache of IE7 and try. may be this is not a way.
#3

[eluser]spider pig[/eluser]
I tried the site on another computer and it worked fine.

I tried your suggestion of clearing the cache and that didn't work.

Apparently the default setting was to block cookies. Anyway, once I changed the setting, it now works fine.

Thanks
#4

[eluser]clariz[/eluser]
I have same problem with this
I tried the site in FF and IE6, it works fine. But when I tested it to IE7, I am redirected to login page.
I am always clearing my cache and I set to allow cookies, but nothing changed.
Please do help...
By the way, the site works great on a local server using IE7.
Thanks in advance...
#5

[eluser]Sumon[/eluser]
Do you test your site from different computer?
#6

[eluser]clariz[/eluser]
Yes, Sumon
Actually i ask a friend to test it either.
But same problem.

Could u help me with this?
#7

[eluser]Sumon[/eluser]
[quote author="spider pig" date="1220935704"]I tried the site on another computer and it worked fine.

I tried your suggestion of clearing the cache and that didn't work.

Apparently the default setting was to block cookies. Anyway, once I changed the setting, it now works fine.

Thanks[/quote]

Seems to me it's cookie issue. is your browser cookie allowed? Please read carefully spider pig's last line of post. change default setting (allow cookie) and hopefully it will work.
#8

[eluser]clariz[/eluser]
[quote author="Sumon" date="1220956303"][quote author="spider pig" date="1220935704"]I tried the site on another computer and it worked fine.

I tried your suggestion of clearing the cache and that didn't work.

Apparently the default setting was to block cookies. Anyway, once I changed the setting, it now works fine.

Thanks[/quote]

Seems to me it's cookie issue. is your browser cookie allowed? Please read carefully spider pig's last line of post. change default setting (allow cookie) and hopefully it will work.[/quote]

Thanks Sumon..
But that didn't work for me...
I don't know what's the reason. I already set to allow cookies. Again, nothing happened.

Thanks a lot for the help.
#9

[eluser]clariz[/eluser]
Thanks Sumon..
I have tried it once more.(tried allowing browser cookie)
I'm glad that it works.
But if I try to logout my site then login again, I found out that same problem exists.
Sorry, I don't know the reason behind.

Thanks for the help. ;-)
#10

[eluser]clariz[/eluser]
Thanks for all the help Sumon...
Now I've decided to use PHP native sessions to answer this problem
Like what others are doing...
But I really wanted to know what the real problem is.
Is it the browser or the CI session?

By the way, thanks.
I wanted to learn more about CI session.
I just post if I found any solution Smile




Theme © iAndrew 2016 - Forum software by © MyBB