> > hey all,
> >
> > I was wondering how one would suggest removing items from a cart system
> once the session lifetime has expired. I have it set to the default 0,
> which expires the session on browser close, what I want to be able to do is
> "delete * from Cart where session='$PHPSESSID'" when the user closes thier
> browser window is this even possible? maybe using
> register_shutdown_function or something? > > Any ideas would be great! > >
> Thanks > > Joseph
>
Since HTTP connections are "stateless" their can be no communication
initiated from the server-side that instructs the browser to tell the server
that the browser has been closed. In other words, once an HTTP
request has been made, the browser and server talk to each other while
the file(s) is/are transferring and will not talk again until the browser
asks for more. Getting any other behavior from an HTTP connection
would require something to run on the client side (like a javascript). The
reason your cookies go away when they have a lifetime of zero is
because the browser throws them away. This really doesn't have
anything to do with the communication between the browser and the
server (the server didn't see that the browser was closing and delete the
cookie from your machine for you).
We personally run perl scripts out of cron at 2:00 every morning to clean
up all tables that need cleaning. This could be done in pretty much the
same manner using the PHP language if you run the CGI version of
PHP. If you're already using the CGI version of PHP, there isn't any
disadvantage to using either it or perl scripts to do this clean-up. If
you're running the Apache module version of PHP, you'll need to find a
tool that can be invoked from the command prompt (such as perl) to do
this for you.
Good luck...
Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
For a good time,
http://www.AppIdeas.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]