This php script can be used to manage session times for users on a website. Each time a
page is loaded that requires a session timeout, this script is included that checks if the
last action by the current user was over a specified number of seconds, which would indicate
that the session has expired. If the session has not expired, a variable is updated with
the current date/time, which will be used to calculate the time in between requests from the
user. When the amount of time between the last request and the current time is greater than
the maximum session length, the session is expired.
The script is included in any page that requires a time-out for security purposes, and
checks how long since the last page request by the user. If the length is greater than
the specified amount (in seconds), the session is expired. If the amount of time between
requests ('last_action' and the current time) is less than the maximum session length, the
session is refreshed by updating the 'last_action' (or similar) session variable.