How to check if session is dead?


I am using $PHPSESSID to store some visitor information in the database. If the visitor on the website has registered then the information stored in the database is permanently stored in another table.

But I am not able to determine on how to delete the information stored in the temporary table if the visitor has not registered and left the site ? I just need to safely delete the data which is not required and not to delete the data of the active visitors.

One way i figured is that if I could get what is the time limit of php session’s then I could simply delete the entries that are older than the time limit. But how do i know what is the time limit set to ?

Please help.


What if the user has not registered and he’s still browsing the site when the cron run ? The info. stored will get deleted.

set a condition on the delete statement… only delete posts from yesterday and backwards, that way users currently browsing and adding items, will not be affected.

create a field and set default 0, then, when the user has registered, set the value to 1, next, create a cron job to clean these fields.