What you can do is store the time of each page load in a $_SESSION var and then check it when you load the next page. If the time is too long, log the user out. This will not log them out after a given period of time, but it will disallow them from carrying out an action, as when they request the next page, they will be logged out.
PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.
Don't forget to save everyone time and mark your thread as Resolved :)