Solved

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

Posted on 2011-03-06
4
461 Views
Last Modified: 2012-06-27
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
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35045220
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
 

Author Comment

by:sabecs
ID: 35045251
Hi Dave, I am talking about 'session_id' in PHP sessions .
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 35045647
0
 
LVL 2

Expert Comment

by:sapparod
ID: 35067916
I think you have to config php.ini. This will remove inactive session from system.

session.gc_maxlifetime = 60
session.gc_probability = 100
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different Javascript on iPhone than Win 10 desktop? 7 54
Code planning methods/tools? 5 56
How can I split a variable 19 45
display data from multiple ajax calls 9 41
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question