Hi!
Whenever I close the browser without logout, the session stays as it was before.Is there any way out to automatically destroy session after some time??
I found the following code on internet but cudnt understand what is $_SESSION[‘last_seen’]
Sessions automatically get destroyed by the browser upon exit, unless you set a cookie or changed the session expire time via your php.ini file its not possible for it to still exist.
As for the code above last_seen is the array key for the session, it sounds to me like you are fairly new to this and i recommend you read through this to get a better understanding of them.
Like i said above last_seen is the array key in the super global $_SESSION, there is no database involvement with sessions unless you want to track a users movement around your website. Again it sounds like you are fairly new to all of this and i do recommend you read the link i gave you as it will help.