zend-frameworkzend-sessionzend-layout

Redirect to login if user inactive zend


I want to redirect to login page if user is inactive for 30 minutes.

Where to write the code and how? I have layout.phtml. Is it the right place to check session expired and redirect?


Solution

  • You can check user inactivity with Javascript. If you want to check this in all pages of the site, layout.phtml is the right place to insert the Javascript. Check SO threads like this - How do i detect if the user is "idle" with javascript? - for sample scripts.