[phplib] Auto clearing of temp files From: Miri (miri <email protected>)
Date: 05/29/00

Hello, I'm a first time programmer who was asked to set up a shopping cart
by my employer. I've managed to get everything working except for two
things: the auto clearing of temp files; the 'expired' function.

In order to shop with this shopping cart, one doesn't have to log in. I'm
not sure if that is adding to my problems or not or if my two problems are
related. I check for the occurance of a session ID on each page - if one is
not there, I require the initiation file that includes my cart variables
and registers them. I use cookies to set the session id, but have url/get
as a back up. I pass the session ID and the current time via each and every
url (I pass the time to try and keep old cached pages from showing up).

As soon as I add the following to my session header:
$limit=7200;
$time_lapsed = (time(void)) - $r;
if ($time_lapsed>$limit) {
        header("Location: /store/expired.php?&sid=".$sess->id."&r=".time(void));
}

Were $r is the time when a user first pulled up a shopping cart page.
I get taken to the 'expired' page no matter what my variables are set to.
(I have a 'debug' file that is echoing out every variable - it can show a
time lapsed of 1 and a time limit if 7200, but I'm still taken to the
expired page). Any ideas? I feel that I'm missing something very simple.

Also, the session ID files that are written to the temp directory are never
cleared out. Am I supposed to write a script to delete them? I've read
through the PHPLIB documention until I'm bleary eyed and can't seem to find
anything specific - just references to a 'garbage collection that reaps
session
records' - but can't seem to figure out how to actually delete the temp
files. I am unsetting my cart after a successful order, but still have the
session id files in the temp folder.

Any pointers would be appreciated.

___________________________________________________________
miri <email protected> miri <email protected>
http://miriland.com/ http://www.stigma.com

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>