if you store login information in a session, you can set the session cookie lifetime to 15 minutes. Session cookie is refreshed with every page view, so it won't log you out after 15 minutes being logged in. See [man]session_set_cookie_params[/man]
As for logout at specified time - either check it in the script, using some flag to mark that the user has been logged out once at this hour, or delete session files from disk.