• 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Codeigniter

#1
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.
Reply

#2
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/w...ve-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"); 


Passionate PHP Programmer & Codeigniter Developer :- Always happy to help you!
Reply

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

#4
(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?
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#5
(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"); 
Passionate PHP Programmer & Codeigniter Developer :- Always happy to help you!
Reply

#6
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"); 
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.