I've had a look at some posts with similar titles checking status of session with session id, and How to tell if a session is active?, but they don't seem to be specific to what I am trying to achieve.
I am building a cart in which users are able to add to it regardless of whether they are logged in or not - by using $_SESSION
and session_id()
.
Adding items to the cart add entries to the shopping cart table with the session id.
Long story short, how do I figure out from a list of session IDs, which sessions are active and which are not (for use in a crontab) so I can remove redundant items from the shopping cart table in the database?