Jump to content

how many users online, PHP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
ststacytucker9

ststacytucker9

    Newbie

  • Members
  • Pip
  • 7 posts
Anyone can tell me the way to display how many users are online in the site in PHP without utilizing mysql?

#2
Bioshox

Bioshox

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 207 posts
It would be pritty difficult to do this without MySQL

Your best bets are to look into jQuery/AJAX

#3
ststacytucker9

ststacytucker9

    Newbie

  • Members
  • Pip
  • 7 posts
Thanks for Suggestion

#4
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Yes, in MySql it won't be too hard. Best would be to basicly add an entry to the database ( say, a table called 'usersonline' ) each time a user visits a page / acts, including the timestamp the user did and the IP of the user, etc. and then each time a page is loaded, remove old entries of like 5 min ago for example ( WHERE timestamp < '".time()-300."' ) and you'll end up with all entries of acts from users of the last 5 minutes for example, and then you could select these ( only UNIQUE/DISTINCT IP ones, so one user will only be counted once ) to count the amount of online users.

If you would like to do this with MySql and need any help, just let me know =].