Jump to content


Photo

Need some help (users online)


  • Please log in to reply
2 replies to this topic

#1 trg86

trg86

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 21 January 2013 - 10:23 PM

Hi there guys. I yet again have something I am wanting to do with my project, but I have never really practiced or used before. What would be the easiest way for me to display a list of the currently logged in users (by their username) logged into my system? I can post snippets of my code if you are needing to see something specific. I know doing something like this will involve the users session.

Thanks in advance!

#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 21 January 2013 - 10:25 PM

You store the current time in their row every time they load a page. When you pull the list of online users, you generally chose a time such as 5 minutes. If their last page view was less than 5 minutes, they're "online". 

That's the best you can do.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#3 trg86

trg86

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 21 January 2013 - 10:31 PM

Thanks for your reply Jessica. By any chance, would you be able to give me code examples? I am not really sure how to go about doing it, thanks! :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com