how to track user logged out or not? when a user is idle?



how to track user logged out or not? when a user is idle?..

Answer / Amritanshu Kumar Singh

In PHP, you can track user login status and detect idle time by maintaining session variables. You can set a session variable to indicate if the user is logged in and another variable to record the last activity time (e.g., timestamp on page load or mouse movement).nTo check if the user is idle, compare the current time with the last activity time and calculate the elapsed time. If the elapsed time exceeds a predefined threshold (idle timeout), you can consider the user as idle or logged out.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How do i explode this string '||25||34||73||94||116||128' i need to have a array like this array ( 0 => '25', 1 => '34', 2 => '73', 3 => '94', 4 => '116', 5 => '128' ) explode("||", $array); didnt work for me i get this array array ( 0 => '', 1 => '25', 2 => '34', 3 => '73', 4 => '94', 5 => '116', 6 => '128', )

2 Answers  


what are the current or latest versions of LAMP ? Linux, Apache, MySql, PHP

4 Answers  


Is php 5.6 secure?

1 Answers  


What is regular expression in php?

1 Answers  


What percentage of websites use php?

1 Answers  


How to terminate the execution of a script in PHP?

1 Answers  


Why php language is used?

1 Answers  


How to execute an sql query? How to fetch its result?

1 Answers  


How to read a file in binary mode?

1 Answers  


What do you mean by having php as whitespace insensitive?

1 Answers  


Tell me how do I escape data before storing it into the database?

1 Answers  


What are the differences between include() and include_once () functions?

12 Answers  


Categories