seems like you need to add code to the previous page which redirects the user if they don't have a valid session, otherwise, depending how you coded it, it may keep the session alive.
PHP Code:
<?php
if (!$_SESSION['user']) {
header("location: login.php");
exit;
?>