While learning how to create and manage a session, I got through session time out technique, I got throw 2 ways :
1. Setting up garpage collection directive in php.ini file and
2. Create a session variable named, say, EXPIRE that holds the value
at the beginning of a session and then keep checking if it's the correct time to expire or not yet.
My question is : which is the best practice in practical life? to depend on the server configuration file? or create your custom time out session??
Thank you in advance
2 Years Ago
Related Article:PHP File Session reader
is a PHP code snippet by digital-ether that has 4 replies, was last updated 2 years ago and has been tagged with the keywords: files, read, serialize, session, sessionvariables.
What is your objective in "managing" the session. PHP will take care of this for you automatically. If you need to make the session timeout shorter or longer there are values in php.ini that you can change. I'd say that best practice is to leave it alone unless you have a specific need.
Thank you for your reply, I was thinking about multi-language website, creating a session variable with the selected language , or the default if none selected, and if no response received during certain time, destroy the session (that's the default language will be viewed not the previwsly selected one).
Please correct my thinking as I'm a beginner and it's my 1st time to do this.