Logged in members.. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Logged in members.. (/showthread.php?tid=40380) |
Logged in members.. - El Forum - 04-07-2011 [eluser]Roy MJ[/eluser] Hi, I was wondering if anyone has an idea of getting the active members who are logged-in a website.. Is it possible to get the value from sessions..?? My thght till now is that while user logs in we shud create a status field in the table and when he is logged in then the field shud be 2 and if its logged out it shud be 0. In this forum itself it has got a place at the bottom in forum home where it shows all active members.. Logged in members.. - El Forum - 04-07-2011 [eluser]InsiteFX[/eluser] Here is the table structures. Code: -- InsiteFX Logged in members.. - El Forum - 04-07-2011 [eluser]Roy MJ[/eluser] wow.. this is cool.. I was thinkin nonsense until i read the above.. Adding members to online members table is fine.. But will it be deleted if the user logs out(consider i include the deletion part in the logout controller )? cuz i have had experiences of logout not working properly, if i click back in the browser the session will also trace back... Also how will i get the visitors ip address when they reach any of my website pages.. Or this is done only for homepage... Will this do?? I just searched it from the user guide.. Code: $this->input->ip_address(); Logged in members.. - El Forum - 04-07-2011 [eluser]Joseph Wensley[/eluser] Just search for users where the timestamp is less than say 10 min old. Just make sure you update the timestamp every time they load a page. Logged in members.. - El Forum - 04-07-2011 [eluser]Roy MJ[/eluser] ok.. so i just have to update the table virtually on every function using time();..?? or can it be done in site_settings...?? Logged in members.. - El Forum - 04-07-2011 [eluser]InsiteFX[/eluser] In your auth library constructor check to see if they are login if not then log them in as a visitor like a dummy login, then add the vistor to the visitors_online table. If they are a user then log them in and add them to the users_online table. You will also need to check for banned users on your login. When a visitor logs out and leaves you need to delete them from the visitors_online table also when a user logs out you need to delete them form the users_online table. I am writing a new auth system that will be using all of this now... InsiteFX Logged in members.. - El Forum - 04-07-2011 [eluser]Roy MJ[/eluser] Oh k very nice then.. so will wait for your updates regarding this.. |