Hi I've got a site running PHPv4.3.11 and the host has register_globals turned on but the webhost desperately wants it turned off. They've got a really ancient shopping cart in there which stores the cart in sessions but not in a database etc. The shopping cart is due to be replaced so I need a quick fix if possible. So the problem... User clicks to add an item to the cart script registers the session scripts adds the cart to the session script adds item to the cart script redirects to a new page new page reads the session and recreates the cart If I get a dump of the cart just before the redirect I can see the contents but just after it's empty again. I tried setting session_write_close but in firefox it made no difference, in IE I got huge error messages about using obsolete functions. So, I'm guessing that there's something that needs to be set but I can't see it. Any ideas?
You can override PHP's session handling mechanism to store session variables in a database (or anywhere else), all without touching the ancient code (except maybe for a one-line 'include' statement). For a good example, take a look at Drupal's session-handling code, from which I think you should be able pretty much copy & paste to your own code: http://cvs.drupal.org/viewcvs/drupal/drupal/includes/session.inc?rev=1.14&view=markup