Login error, session and code redirection in Internet Explorer?

I am still new to code igniter and I am having problems with the login system.

Logging in always works when I use Firefox. Logging in sequentially works in some IE7 browsers, but subsequently crashes in other IE7 browsers.

When tracking the code, I see that the / redux _auth_model.php models successfully authenticate the user, he writes the user information to $ this-> session-> set_userdata () and redirects them to the participant’s page of my choice, Here is the code:

public function login($identity = false, $password = false) { $identity_column = $this->config->item('identity'); $users_table = $this->tables['users']; if ($identity === false || $password === false || $this->identity_check($identity) == false) { return false; } $query = $this->db->select($identity_column.', email, password, group_id') ->where($identity_column, $identity) ->where('active', 'Active') ->limit(1) ->get($users_table); $result = $query->row(); if ($query->num_rows() == 1) { //$password = $this->hash_password_db($identity, $password); if (!empty($result->activation_code)) { return false; } if ($result->password === $password) { $this->session->set_userdata($identity_column, $result->{$identity_column}); $this->session->set_userdata('email', $result->email); $this->session->set_userdata('group', $result->group_id); return true; } } return false; } 

I made a session dump variable $ this-> in IE7 and FF and confirmed that all user data remains untouched until redirected. My email details, group information, and team identifier information were indicated at the session.

However, after redirecting, the session data is empty in some IE7 browsers, so CI continues to unload me from the system. It is completely intact in other IE7 browsers and always intact in Firefox.

Why is session data browser dependent?

Any ideas on how to fix this problem further? I am puzzled ...

+6
redirect codeigniter session
source share
12 answers

This is a complex issue with the Codeigniter database session class, in the end I resorted to using my own sessions with the replacement replacement found here: https://github.com/EllisLab/CodeIgniter/wiki/Native-session

+7
source share

I had the same issue when using a CI session in IE. Then I use the header below in the controller constructor, and it works for me.

Here is the title:

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

+6
source share

I encountered the same problem when using IE8 in browser mode. I found that the problem is a match with the user agent. In the session database, it saves useragent as IE7, but it gets IE8 from the cookie. I set $config[sess_match_useragent] = FALSE and the problem is resolved.

+4
source share

The session class works fine in several of my projects, including support for IE6 / 7/8 (including several CI releases). There are several things that may be causing this, outside of the code inserted above:

  • Call $this->session->sess_create(); from the base class (or elsewhere in your class code) will reset your session.
  • Try combining the calls to set_userdata to one call by passing an array to it.
  • Make sure there are no unexpected characters in your data (this may cause problems in some browsers).
  • Make sure that your session class settings in the config do not skip cookies every request.

Alternatively, consider an alternative session class, such as Native Sessions

+3
source share

This is a problem that someone made a third-party fix, it fixes the session controller. Let me dig it out. I used it in my codeigniter settings since it was first marked.

This issue is related to IE7 / IE8 with redirection or frames.

EDIT

Here is the link I found earlier, it helped me with the IE problem. Hope this is what causes your headaches: http://www.philsbury.co.uk/blog/code-igniter-sessions

+2
source share

This is a problem with browsers. I put this in MY_Controller in the constructor:

 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); 

eg:

 if($this->uri->segment(1)=='admin') header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); 
+2
source share

We developed the Facebook tab app when we encountered this problem. We tried it to no avail. Here's what we found out:

  • IE privacy settings seem to be medium or less
  • If you use the page app, make sure the BOTH URL has the HTTPS protocol.

Also, check out our Compact Cookie Privacy Policy.

+2
source share

config.php configuration application

 // 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. $config['cookie_secure'] = FALSE; 
+1
source share

I solved this using my own php session instead of cookies (Storing codeigniter session_id in my own php session).

You can grab the library here: https://github.com/staskus/codeigniter-2.--native-session .

Just copy the MY_Session.php file to your application / library

+1
source share

The problem is that IE denies that the CI cookie is trying to set. Native sessions are one way, however, if you wanted to keep using CI sessions, I had success with the following troubleshooting:

  • Make sure the $ config ['cookie_domain'] parameter in config.php is not empty.
  • Remove the underscore from $ config ['sess_cookie_name'], for example, change "ci_session" to "cisession"
  • Check if the server time is correct.
0
source share

I hate IE !!!

his work now gives P3P to our controllers that fix the problem:

 class Chupacabra extends CI_Controller { function __construct() { parent::__construct(); header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); } 
0
source share

This issue haunted me when I tried to get the CodeIgnitor login page. The session will not save.

It turns out this is due to the domain name that I created from FREEDNS containing the underscore ( _ ). I renamed the domain name using period ( . ) And returned all the code changes that were suggested in this post, and Voila, it worked.

Thanks for all the comments and materials on this page, because they really led me to the next investigation of this underscore.

0
source share

All Articles