When the session expires, the data is no longer present, so something like
if (!isset($_SESSION['id'])) { header("Location: destination.php"); exit; }
will be redirected whenever the session is no longer active.
You can set how long a session cookie is supported using session.cookie_lifetime
ini_set("session.cookie_lifetime","3600");
EDIT: If you synchronize sessions due to security problems (instead of convenience), use the accepted answer, as the comments below show, this is controlled by the client and therefore is not protected. I never thought of it as a security measure.
Vinko Vrsalovic Jun 18 '10 at 10:15 2010-06-18 10:15
source share