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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -