dan
dan

Reputation: 179

Codeigniter create session and redirect not working in IE

I'm using codeigniter and have a simple user login setup. User submits their credentials, checks with the DB if they are valid, if they are the model passes the controller a session ID and is redirected to the user page. If the data is not correct the user is redirected to the login page with an error message. Nothing fancy here. The problems is it doesnt work in IE. I'm not sure if its because of the redirect or the session creation. Works fine in all browsers except IE. I tested ie 8 with windows 7 on parallels and worked fine. The weird thing is that it doesnt work with on a pc with windows 7 IE 8. Can someone tell me why the login page just keeps getting refreshed every time the user goes to login? I was told to try and add this code :

<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" /> </head>

Which did nothing. I also changed the session handler from ci_sessions to cisessions which didnt help either (i saw this on another forum). Can ANYONE help?!

Upvotes: 2

Views: 2344

Answers (3)

Jamal
Jamal

Reputation: 306

I was having the same problem while using CI Session in IE. I used the below header in the controller constructor then and it works for me now:

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

Upvotes: 2

Cadmus
Cadmus

Reputation:

I had similar problems where ci sessions were not working in windows xp but everywhere else. So I used the Native Sessions library by Dariusz Debowczyk and it fixed the issues. The nice thing is Darius did a good job of keeping the interface the same so you would not have to change your code that much. You can still use $this->session->userdata() and $this->session->set_userdata()... etc. You can also use flashdata. The only difference is in the destroy function instead of $this->session->sess_destroy() he uses $this->session->destroy().

http://codeigniter.com/wiki/Native_session/

Upvotes: 1

Dustin Carpenter
Dustin Carpenter

Reputation: 313

Have you tried using CI's redirect method contained in the URL helper to see if this works for you?

http://codeigniter.com/user_guide/helpers/url_helper.html

Upvotes: 1

Related Questions