Jump to content

Automatically logout after 5 min not working in php


sandeepm

Recommended Posts

i need logout code for apllication. This code is working properly but the issue is when the mouse moments on that browser it's not working can you tell me please..

 

$url = BASE_URL; $url1='home/logout'; $TimeOutMinutes = 5; // This is your TimeOut period in minutes $LogOff_URL = $url.''.$url1; // If timed out, it will be redirected to this page $TimeOutSeconds = $TimeOutMinutes * 60; // TimeOut in Seconds if (isset($_SESSION['SessionStartTime'])) { $InActiveTime = time() - $_SESSION['SessionStartTime']; if($InActiveTime >= $TimeOutSeconds) { echo "<script type='text/javascript'> window.onload = function () { top.location.href = '" . $LogOff_URL . "'; }; </script>"; } } $_SESSION['SessionStartTime'] = time();

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...