The area of the site I am developing is for a small set of terminals to the main site for employees to check personal details. Under normal circumstances, these sessions would last a few minutes. The purpose of the expiry is to stop people leaving personal details on the screen, bank details specifically.
If they take too long, then I want to them to have to login again. 3 minutes to check your name and address is plenty.
So.
Each time I load a page in this section of the site, I use ...
session_set_cookie_params(180);
session_start();
This (I think) sets the session cookie to last 3 minutes. I also have a 3 minute refresh on the pages (automatically re-loads the logon page).
As long as the cookie is reset each time a page loads, then I am happy.
The problem is caused when an employee leaves themselves logged in. If someone else comes to the pc, they can start looking at the information about the previous user (bank details, etc).
I think 3 minutes is way long enough.
Is there a way of determining when a cookie is going to expire?