budimir Posted April 6, 2008 Share Posted April 6, 2008 Hey guys, I need a small help. How can I get a list of all logged in users??? And big question is how can I now that user is not active anymore, if he hasn't hit log-out button. Thanks. Link to comment https://forums.phpfreaks.com/topic/99844-logged-in-users-session/ Share on other sites More sharing options...
trq Posted April 6, 2008 Share Posted April 6, 2008 This question gets asked quite a bit, have you searched the board? Link to comment https://forums.phpfreaks.com/topic/99844-logged-in-users-session/#findComment-510640 Share on other sites More sharing options...
unsider Posted April 6, 2008 Share Posted April 6, 2008 Write a SQL query that retrieves all of the $_SESSION['username'] in the DB. if you set the 'username' = $_SESSION['username']; when you input the data, then when you retrieve 'username' the values should output correctly <?php $dbname = 'databasehere'; mysql_select_db($dbname); $query = "SELECT `username` FROM `users` LIMIT 0, 5"; $result = mysql_query($query) or die('Error, query failed.'); while($row = mysql_fetch_array($result)) { $username = $row['username']; echo "These are the listed users:" . $username . ", "; } ?> Quick little bit of code I wrote for you, mess with it. Hope it helps. Link to comment https://forums.phpfreaks.com/topic/99844-logged-in-users-session/#findComment-510647 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.