Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:09:11+00:00 2026-06-15T01:09:11+00:00

I am working on a chat application in PHP. Here I am saving one

  • 0

I am working on a chat application in PHP. Here I am saving one login session_id in to my database. When a user logout I am setting this session_id to null. So by this way I am getting who other users are logged in. My script is checking for every 5 second for this session_id & respective message if chat box is open.

Now suppose user has closed the browser itself, then how to remove him from chat-box active user list ?

When we are closing the browser, the session will get expire. Is there any thing I can trace which are all session_id‘s currently active on a server for a particular website ?

Or Is there any way to Track all active users for chat application in PHP ? I am not getting what parameter I am missing here.

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:09:12+00:00Added an answer on June 15, 2026 at 1:09 am

    Exactly how Lucas said. Have a timestamp field calld e.g. “last_seen” and update it via AJAX in every 5 seconds (what you are doing right now anyway). Then you may think about all users that this query return as being active:

    SELECT * FROM user WHERE last_seen > CURRENT_TIMESTAMP - 30;
    

    and all others are offline (closed their browser or sth).

    In the above query we assume that if user has not been seen for 30 seconds – he is offline. This value can be lower, but must be above 5 seconds (your refresh interval) because there always can be some delays in updating last_seen column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on on an AJAX chat application using php, mysql. It's
I'm thinking of integrating a chat inside an already written and working php application.
I'm working on a simple AJAX chat add-on for my PHP application so I
I am working on a Chat application. I need to verify user that only
Hi everyone I am working on an Ajax web chat and this application is
Im working on a Client/server chat application which allows user to send files (images
i am working on a chat application. I am able to send and receive
I am working on android chat application. I am facing a problem in send
I'm working on a chat application with Node.js and Socket.io, and on disconnect, the
I am working in android chat application. I used SmartFox server. I am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.