diff --git a/client/src/pages/guide/english/php/sessions/index.md b/client/src/pages/guide/english/php/sessions/index.md index 38431d723a..dcf0534b64 100644 --- a/client/src/pages/guide/english/php/sessions/index.md +++ b/client/src/pages/guide/english/php/sessions/index.md @@ -38,6 +38,42 @@ session_unset(); session_destroy(); ``` +Here's a full example to manually expire a user's session: +```PHP += $expireAfterSeconds){ + //User has been inactive for too long. + //Kill their session. + session_unset(); + session_destroy(); + } + +} + +//Assign the current timestamp as the user's +//latest activity +$_SESSION['last_action'] = time(); +``` + ### Sessions Are Temporary It is important to not treat a session as permanent storage. They get cleared from time to time by the developer, whenever the application is moved to a new host server, by the application itself (for example a logout button), and even during server maintenance. For long term storage of data make sure to use a database.