Jump to content

[SOLVED] users logged in


rempires

Recommended Posts

I know this is kind of a very broad psot, btu i'm not sure were to start with this one. I have made a user log in area for my website allows them to create/edit profile view restricted pages and all, this all works good, what i want to do is be able to show who is logged in.  like phpBB and smf forums and all those ahve a users logged in. it shows who is logged in and what there viewing and stuff. manily i jsut want to tell if somone is logged and, and if i would also but able to keep track of the time there logged in this would be great. Like i said i ahve no idea were to even start with this so i'm not sure what information you would need about my loggin code, so please if i don't give required info ask for it, i'll telly ou or psot that little section of code. 

 

things that might help (kinda hit and miss until somone tells me what i need to show you guys, i don't want to post it all here, there is a lot beause i ahve suer levels and control panels for differnt levels and crap...) but log in data connect to MySQL to get user info and check and make sure it all works. then creates a session to make sure the user ahs the appropriate rights to view page is logged and and keep basic info about them as they traverse the site.  My guess would be that showing what suers are logged in would ahve somthing to do with teh sessions, like if there is a way i could amke php pull all open sessions, instead of jsut teh ones for that user, but i really don't know, if you need mroe information please ask and i'll happily tell/post the code you require, i'm not asking for the code for this, btu hoiw it would work, or the functions i need...

Link to comment
Share on other sites

so when they log in i just put there session in a db? but then how would i know when they logged out if they just say close the browser instead of hit the log out button. is there a function in php to check and see if that current session is active, like i put the session id into the mysql table on log-in, then i have a cron job run every 10 min to see if the sessions in it are currently active? thanks in advance, john

Link to comment
Share on other sites

i couldn't find anything through google but in php's site i found msession_list, msession_count... unfortunitly there all undocumented, but msession_list says lsit all sessions, so this might work, thank you everyone, i will actually probably be going the database route because this way i can get a rough approximate amount of time they were on to. thanks for all your help again, john (uhh i'll mark this as solved when i figure out how...)

Link to comment
Share on other sites

 

If you use a sessions table, you update the session time in the database everytime a user loads a page. You then log them out if a session update time is a certain amount of time greater than the session start time. Everytime it updates it checks...etc. So it will be as accurate as you can get within a few minutes time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.