zgkhoo Posted October 9, 2007 Share Posted October 9, 2007 how to detect user online/offline? by storing user login status inside mysql? wat if user go offline? how php know when user get offline or close the browser? thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/72401-how-to-detect-user-onlineoffline/ Share on other sites More sharing options...
L Posted October 9, 2007 Share Posted October 9, 2007 what I did was when a user logs in the online column turns to a value of 1 then on the top of each page I have the timestamp column updated, but if that timestamp hasn't been updated in more than 10 minutes I switch the online column to 0 Quote Link to comment https://forums.phpfreaks.com/topic/72401-how-to-detect-user-onlineoffline/#findComment-365138 Share on other sites More sharing options...
MasterACE14 Posted October 9, 2007 Share Posted October 9, 2007 you could create a $_SESSION variable with the username, or ID whatever. and have that inserted into your MySQL database, and if it isn't set on whatever page they go to, you remove it from the database and log them out, but their is always the other small problems that come to mind. what if they close the browser? what if they don't log out? what if they don't login and hack the URL? Your best bet is probably to Try google and try and find a OOP script that works Sessions with MySQL, their are a few out their. The only really tricky part is setting them up. Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/72401-how-to-detect-user-onlineoffline/#findComment-365139 Share on other sites More sharing options...
zgkhoo Posted October 9, 2007 Author Share Posted October 9, 2007 thanks again..but wat u meant by "what if they don't login and hack the URL?" wat u meant by hack the url? Quote Link to comment https://forums.phpfreaks.com/topic/72401-how-to-detect-user-onlineoffline/#findComment-365248 Share on other sites More sharing options...
zgkhoo Posted October 29, 2007 Author Share Posted October 29, 2007 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/72401-how-to-detect-user-onlineoffline/#findComment-380481 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.