Anyone can tell me the way to display how many users are online in the site in PHP without utilizing mysql?
how many users online, PHP
Started by ststacytucker9, May 04 2010 01:40 AM
3 replies to this topic
#1
Posted 04 May 2010 - 01:40 AM
|
|
|
#2
Posted 04 May 2010 - 01:44 AM
It would be pritty difficult to do this without MySQL
Your best bets are to look into jQuery/AJAX
Your best bets are to look into jQuery/AJAX
#3
Posted 04 May 2010 - 01:46 AM
Thanks for Suggestion
#4
Posted 08 May 2010 - 03:15 AM
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 =].
If you would like to do this with MySql and need any help, just let me know =].


Sign In
Create Account

Back to top









