PDA

View Full Version : [PHP] Server status and online users



Isolde
17-10-2017, 11:46 AM
Hi i am making my own game and wanted to add a part to my site with the online status of my game, being online or offline and users online how do i do that? im a basic learner with html and php

_spirit
17-10-2017, 07:32 PM
scottish;


Sent from my iPhone using Tapatalk

augmentedRunes
18-10-2017, 02:04 PM
Without a lot more information to base your request off of, it can be very easy to do, or slightly more involved.

A few questions would be:

1. How do you want to determine someone's online/offline status? Are you basing it on amount of time "idle" or just based on clicking a logout/login button?

2. Based on the above, if amount of time is your determination, how long is your "idle" requirement before you want them logged out?

3. Do you already have a database of users?

Without much information, your basic setup will be as follows:

Database is created to store users with certain criteria columns you need, I.E online/offline, time stamp (if you're basing it on "idle" time) and so on.
User logs in > session for that user is created and "online" or "time stamp" is set.
User logs out > session for that user is destroyed and "offline" is set or "time stamp" is updated.
User does some sort of activity (based on "idle" time) > check "time stamp" to see if it's over the amount of your "idle" setting, and if so, destroy the session and "time stamp" is updated.
Using appropriate queries, you can then show users based on their "online" or "time stamp" status.

Isolde
07-11-2017, 12:26 PM
Anyoneee

Want to hide these adverts? Register an account for free!