CodeIgniter Forums
Problem with Codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with Codeigniter (/showthread.php?tid=61754)



Problem with Codeigniter - gentilezza - 05-14-2015

Dear Codeigniter Team,

We have a problem with Codeigniter framework.

We have created Information System with Codeigniter 2.2.2 which each user can logged in with username and password. It's run under apache 2.4 web server and php 5.6. First the system worked correctly, but after 3 weeks it's work wrong. When user logged to the system by their username and password, they will see on their page, something like "Welcome, James Wagner", but after clicking some of menu like they will see the page another user something like "Welcome, Ann Crud". When one user press Ctrl+F5 he/she will see the own page but other user will see his/her page.

We are sure about our code, because it works in another framework.

I reinstall apache and php, but the problem didn't solved.

There are about 16000 users in our software and we should solve it as soon as possible.
I hope you will help us to solve it.

Thank you. If you need any other question, we will happy to help you.


RE: Problem with Codeigniter - techbat - 05-14-2015

Codeiginter session Library is internally using COOKIE, so you may get cache issue mostly in IE browsers, means cookie is store in client browser, when client received response header then updated session value will show on client end.
You may resolve issue from following things

  1. You can use other session library that can work with PHP session (ref: https://github.com/bcit-ci/CodeIgniter/wiki/Native-session)
  2. If you want to use CI native session library, then you should mind following things,  When session is created / updated, you should also remove cache from response header.
     
    PHP Code:
     header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); 





RE: Problem with Codeigniter - gentilezza - 05-14-2015

Thank you for the post. Is this error solved in Codeigniter 3.0. Can we use Codeigniter 3.0 instand Codeigniter 2.2.2


RE: Problem with Codeigniter - kenjis - 05-14-2015

(05-14-2015, 07:01 AM)techbat Wrote: Codeiginter session Library is internally using COOKIE, so you may get cache issue mostly in IE browsers, means cookie is store in client browser, when client received response header then updated session value will show on client end.

What do you mean? What's cached?


RE: Problem with Codeigniter - techbat - 05-14-2015

(05-14-2015, 02:20 PM)kenjis Wrote:
(05-14-2015, 07:01 AM)techbat Wrote: Codeiginter session Library is internally using COOKIE, so you may get cache issue mostly in IE browsers, means cookie is store in client browser, when client received response header then updated session value will show on client end.

What do you mean? What's cached?

i am specially saying for IE browser, I had faced strange issue with CI cart item update on IE browser, the cart items was not being update on page load, when i reload page by "ctrl+f5" then cart items was updating.

I google issue, and found IE browser cached response header, see these links
https://msdn.microsoft.com/en-us/library/bb250442.aspx
https://support.microsoft.com/en-us/kb/234067/en-us
The issue resolved when i added cache control header in repose.


PHP Code:
  $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
  $this->output->set_header("Pragma: no-cache"); 



RE: Problem with Codeigniter - kenjis - 05-14-2015

Thank you for you explanation.

(05-14-2015, 10:56 PM)techbat Wrote: i am specially saying for IE browser, I had faced strange issue with CI cart item update on IE browser, the cart items was not being update on page load, when i reload page by "ctrl+f5" then cart items was updating.

I google issue, and found IE browser cached response header, see these links
https://msdn.microsoft.com/en-us/library/bb250442.aspx
https://support.microsoft.com/en-us/kb/234067/en-us
The issue resolved when i added cache control header in repose.


PHP Code:
  $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
  $this->output->set_header("Pragma: no-cache");