bhavin12300 Posted July 13, 2007 Share Posted July 13, 2007 hi in my website i want to show all the member who are signin in my website.like it will sow all the member who whose session are on. how to do that? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 I don't think you can tell which sessions are active or not, at least not with PHP. Here is how I would go about it. Make a column in the users table called "last_active". Every time the user clicks, update that column in the table to the current time with a timestamp. On the page where you are showing the users online, just select all the users from the database where the last_active field is X minutes old, which will select the users that have currently been active. Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 13, 2007 Share Posted July 13, 2007 i havent done something like that but if im going to do that then i will do this when the user log get the information od him and set on the table like active then he leaves set in active how ? when the user logged update the table in your db for that person set as active then before he logout or once he logged out set your table field like in active Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 i havent done something like that but if im going to do that then i will do this when the user log get the information od him and set on the table like active then he leaves set in active how ? when the user logged update the table in your db for that person set as active then before he logout or once he logged out set your table field like in active You can't rely on the user to press "logout" all the time, so your method would be unreliable. Quote Link to comment Share on other sites More sharing options...
bhavin12300 Posted July 13, 2007 Author Share Posted July 13, 2007 thansk you i got your answer . i will do that. that user x minute old.cool logic oce again thank you Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 13, 2007 Share Posted July 13, 2007 i havent done something like that but if im going to do that then i will do this when the user log get the information od him and set on the table like active then he leaves set in active how ? when the user logged update the table in your db for that person set as active then before he logout or once he logged out set your table field like in active You can't rely on the user to press "logout" all the time, so your method would be unreliable. yes i know dude i only giving here an idea if i were to do that ill do an option on my code like before he leave ill put a pop up screen like sure you want to logout look some of the members here aren't knowledgeable enough so giving then all of this stuff will make there nose bleed 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.