soycharliente Posted April 16, 2007 Share Posted April 16, 2007 Google is not my friend and I guess no one in the world knows how to do this. LOL Is the best way to handle it just add a database table field that will hold that data? But then, what if they don't logout and just close their browser? I wouldn't want them to stay in the list. Can anyone help me or point me to a tutorial/post/something that will help me generate a list of users that are logged in? Quote Link to comment Share on other sites More sharing options...
marcus Posted April 16, 2007 Share Posted April 16, 2007 If you want, you can do: 1. Add a time field in your users table and update it each time a logged in user goes to a new page 2. Then: $count_time = time(); $count_time = $count_time-900; //a difference of 15 minutes $online_count = mysql_query("SELECT * FROM `users` WHERE `time`>=$count_time ORDER BY `page` DESC"); echo "<center><table cellspacing=3 cellpadding=3 width=300><tr><td class=bar><center><font class=barfont>Online List</td></tr>"; while($row = mysql_fetch_array($online_count)) { $username = $row['username']; echo "<tr><td><center> <a href=/user/$username> $username </a> </td></tr> "; } echo "</table>"; This should produce a list like: Online List marcus yasuragi Charlie hxcChaos Jakobo ulitrexx Caress Ryan sadie_bledsoe angela peachiekeen Decco cyllarus ninjacore_xxlily Jen lynne kim Quote Link to comment Share on other sites More sharing options...
HeyRay2 Posted April 16, 2007 Share Posted April 16, 2007 We came up with a similar solution in the following thread if you are interested: http://www.phpfreaks.com/forums/index.php/topic,135959.0.html Quote Link to comment Share on other sites More sharing options...
soycharliente Posted April 16, 2007 Author Share Posted April 16, 2007 Yup yup. Thought that was the way I'd have to go. Didn't know if there was some kind of CRAZY PHP session variable. Thanks guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.