php - Log out automatically when there is no use of Keyboard or Mouse -
when not use keyboard , mouse particular time limit (like 10 min or 20 min) @ time should log out user automatically current session. please give me suggestion or code in php.
you need javascript detect browser events.
with jquery, (untested)
var timesincelastmove = 0; $(document).mousemove(function() { timesincelastmove = 0; }); $(document).keyup(function() { timesincelastmove = 0; }); checktime(); function checktime() { timesincelastmove++; if (timesincelastmove > 10 * 60) { window.location = "path/to/logout.php"; } settimeout(checktime, 1000); }
Comments
Post a Comment