dcsimg
Results 1 to 2 of 2

Thread: How to list all online users onto the div that is located in the Online users page?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2018
    Posts
    75

    How to list all online users onto the div that is located in the Online users page?

    How to list all online users onto the div that is located in the Online users page?
    Hi all,
    I am working on a front-end chatting website.
    Here you can visit my website: http://appleschat.com/index.html
    It has three pages, they are:-
    1- The index page: which users can write their username and status.
    Here its URL: http://appleschat.com/index.html
    2-The chatting page: which users will be able to chat with each others through it.
    Here its URL: http://appleschat.com/ApplesChat.html
    3-Online users page:which suppose to display all users who write their usernames in the index page. Here its URL: http://appleschat.com/OnlineUsers.html

    Now my question is : As I mention above How to list all online users onto the div that is located in the

    Online users page?

    Thanks and I appreciated your value time.
    Last edited by Max45; Jul 18th, 2019 at 11:59 AM.

  2. #2
    New Member
    Join Date
    Jan 2020
    Posts
    7

    Re: How to list all online users onto the div that is located in the Online users pag

    Hii Max,
    I have a solution for it,
    first you have to create one table user-online and must have one int entry called online.

    Code:
    $qry =   "CREATE TABLE `user_online` (
                `id` int(11) NOT NULL AUTO_INCREMENT,
                `userid` INT NULL,
                `session` VARCHAR(50) ,
                `ipnr` VARCHAR(20) ,
                `online` int(11) default 0,
                `creationdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
                 PRIMARY KEY (`id`)
                )  ENGINE=InnoDB DEFAULT CHARSET=utf8 OLLATE=utf8_unicode_ci ";
    And add one event which will decrease online value with 10 in every 10 second.

    Code:
    create event online_event2 on schedule every 10 second do
    update dbase.user_online set online= time_to_sec( timediff( user_online.creationdate,DATE_ADD(NOW(),INTERVAL 0 SECOND ) ) )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width