nileshjoshi Posted April 26, 2013 Share Posted April 26, 2013 hi all , am new to php and want to show If user is online[login] Green Dot to be shown next to user profile name.....and if user logout then nothing.....and other login user also see the green dot on user profile which is online......can i need to create a table in my database? please give me some solution... thanks in advance !!! Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 26, 2013 Share Posted April 26, 2013 You've posted this in the wrong forum, I'm moving it for you. Typically you'd store the timestamp each time the user loads a page. Then if the last page load was within X minutes, they're considered "online". Quote Link to comment Share on other sites More sharing options...
nileshjoshi Posted April 26, 2013 Author Share Posted April 26, 2013 Ok thank you...so where can i get solution for this ? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 26, 2013 Share Posted April 26, 2013 You can write it yourself, pay someone to do it, or whine for a while and some chump might do it. I explained the steps you need to take. Where are you stuck? Quote Link to comment Share on other sites More sharing options...
Barand Posted April 26, 2013 Share Posted April 26, 2013 (edited) OK - Chump time!Example table contents USER table userid | username | firstname | lastname | etc PAGELOAD table userid | pageid | loadtime When you list the users then use a query like this so you can tell who is online, assuming if they have not reloaded a page for 15 mins they are offline SELECT u.firstname, u.lastname, (p.loadtime > NOW() - INTERVAL 15 minute) as online FROM user u INNER JOIN pageload p USING (userid) If they are online, the online column returned will be 1 Edited April 26, 2013 by Barand Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 26, 2013 Share Posted April 26, 2013 See, I'm just lazy Barand Of course, OP is going to need the PHP code too. 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.