L
L
Lyuba2018-04-05 20:49:21
PHP
Lyuba, 2018-04-05 20:49:21

Display who is online through the database?

Whether prompt really without sessions them at me is not present.
Display in the admin panel who is currently online on the site authorized users and guests + you need to display on the ad page where the username is indicated online or offline.
Can anyone share the script with instructions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2018-04-05
@DmitriyEntelis

Sessions are about something else.
The general logic in such cases: we start a field for the user in the plate with the datetime of the last action on the site.
(Under the action we understand in a simple version - the request of any page)
Accordingly, we update this field.
All users whose last action time is > (now - nn seconds) are considered online.
For guests, if you need to honestly count, we secretly register everyone, put an eternal cookie with authorization, and then as for authorized ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question