Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

Check if users are currently online using PHP,JavaScript or MYSQL.

Hi,
I have a users table that gets updated with a users session id when they login to my website.

I then check the users table to see which users are currently online.

Is there a way to delete the session id from the users table if the users has been inactive after say 20 mins or if they have forgotton to logoff or have simply shut down their browser or PC?

Can this be done with PHP or JavaScript, should I add a timestamp for the last time the user did something and perhaps run a CRON job to delete users that have not done anything in the last 20 mins?

Thanks in advance for your feedback.
0
sabecs
Asked:
sabecs
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
Are you talking about the 'session_id' in PHP sessions or a variable you're creating?  Like her: http://us3.php.net/manual/en/function.session-id.php ??
0
 
sabecsAuthor Commented:
Hi Dave, I am talking about 'session_id' in PHP sessions .
0
 
Lukasz ChmielewskiCommented:
0
 
sapparodCommented:
I think you have to config php.ini. This will remove inactive session from system.

session.gc_maxlifetime = 60
session.gc_probability = 100
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now