Forum Moderators: coopster
EXAMPLE #1:
Person logs into website to place an order - adds a couple products to their cart... then adds another item... but all previous items are gone - just the newest item is there. I've figured out this issue, and all the items are in the database, but for some reason, a new session ID was generated along the way. When that happens, the customer thinks they lost the items in their cart.
I have only been able to recreate this issue with IE, but... 98% of our customers use IE.
EXAMPLE #2:
Customer Logs in as USER1... browses around. Then logs out and logs in as USER2... but the site is still showing as USER1 (at the top of each page it says "Welcome USER1").... BUT, if the person holds their Ctrl+Refresh (to force a Refresh in IE) - it will show them what they should see "Welcome USER2".
Both issues are extremely frustrating and I cannot find the cause. Below is some info I'm hoping someone can look @ and recognize the problem.
[PHP.INI]
-------------------------------------------
session.cache_limiter = private_no_expire
[PHP CODE]
-------------------------------------------
(On every page I have the following bits of code...in the order provided, but with other code left out of course.)
header("Cache-Control: no-store, no-cache, must-revalidate");
header ("Pragma: no-cache");
session_register("REFERRAL_URL");
session_start();
$SID = session_id();
$REFERRAL_URL = $referring_url;
session_register("SID");
I once had that problem whereby everytime you go to the next page, it create a new session ID, luckly for me it was an intranet site, so this is how I solved that problem
Every time you log in, it create a file with your IP address eg (145.234.22.9.ini) inside that file I store the session ID that you logged in with. Then always read the file and retrive the session ID." Is not an best way to do it but it worked.
As for many files. I delete a file according to the last access time (if it was more than 4 hours ago) We didn't believe one can be in one page for more than 4 hour.
Sorry I could not help only to share my problem too.
I found a few articles that describe the caching problem with IE .... both articles gave pretty much the same answer saying it definately fixes the issue with IE wanting to cache... I did it, but IE is still caching (and I did clear my cache before opening IE again). Here is what I did
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Cache-Control: no-store, no-cache, must-revalidate');
header("Cache-Control: max-age=0");
header("Pragma: no-cache");
Any Clues?
HTTP/1.1 200 OK
Date: Wed, 25 Jan 2006 03:37:38 GMT
Server: Apache/2.0.46 (Red Hat)
Accept-Ranges: bytes
X-Powered-By: PHP/4.3.2
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Thu, 18 Aug 2005 18:51:00 GMT
Cache-Control: private, max-age=10800, pre-check=10800
Pragma: no-cache
Set-Cookie: PHPSESSID=01caf9cda2949486a2ed3c16f9380caf; path=/
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
The one that has me concerned is:
Cache-Control: private, max-age=10800, pre-check=10800
Why is IE receiving that if I'm defining the "Cache-Control" in my own headers @ the very top of the script?
Sometimes the only way to stop IE caching certain things is to make it think that it is a new URL.
I struck this with external JavaScript files.
You would make a change to the JavaScript, but IE would use an old cached version of it until you cleared the cache. In the end I made sure that all the paths to the external JavaScript had a paremeter after it as follows
?ver=###, where the ### got dynamically written from a value in a configuration file, so each time a new version was deployed, it would force IE to reload the JavaScript.