Page 1 of 1

Is there is Session_OnEnd event ON php Like asp

Posted: Fri Nov 12, 2004 1:55 am
by pramod
Is there is Session_OnEnd event ON php Like asp ,

if not how can I get a session end time (If there is no proper shut down or connection cut).

Any one have idea about this please help me


Thank u .

Pramod .K.V.P

Posted: Fri Nov 12, 2004 4:38 am
by AVATAr
Php clear the sessions after a timeout, so you dont need to do it if you are using sessions like php handles it.

If you are using sessions withing a DB you need to do the cleanup manually (with a cron)

Posted: Thu Nov 25, 2004 4:39 am
by pramod
My actual requirement is that .

when client request to my page the i will start a infinate loop to get the aproximate time he is conected with that page . I want to sto the execution of that script when the client close the browser or go to next page or click on stop button of browser .

Please help me to solve the situation.

Posted: Thu Nov 25, 2004 4:54 am
by AVATAr
You dont need to make an infinite loop.

When your client request you page, save a timestamp for that user (you can do it un a Database, use the session id to identify the user, or some source of authentication method).

You cant have the moment when the user close the browser with php. What you can do, is register their last activity. In every page the user open you can put a function that update the record of the timestamp.

A table un the DB:
ClientID - TimeStampStart - TimeStampLastActivity.

Or you can make all your script like this:

http://mysite.com/go.php?url=newlink.php

and do the trick in go.php, and after you update that record, just redirect the browser to newlink.php


Hope it helps.

(Damn, i was writing this and when i submit it: phpBB Critical error, cant connect to DB. ) :(