Jump to content

Loginsystem


Jack McKalling
 Share

Recommended Posts

Hey, I have build a loginsystem (next to a membersystem and a registersystem).Members can register, log in and log out, and all is saved in sessions. But if the user is inactive for a certain period of time, the cookie stored at his computer will be deleted and logged out of my site. But the statistics remain the same, how can I change that?Without having the statistics trace the cookies :)?

Link to comment
Share on other sites

But if the user is inactive for a certain period of time, the cookie stored at his computer will be deleted and logged out of my site. But the statistics remain the same, how can I change that?Without having the statistics trace the cookies :)?

ok you say the statistics remain the same. is that the same as when they were loged in? or is it the same as something else? I guess what i am confused on is what you are trying to do with your statistics.
Link to comment
Share on other sites

Well, I have losts of statistics saved into my database, and each time a user logs in, the system adds an entry in the database. When the user logs out by the form, the entry gets modified :)But if the user does not click the log out button but gets inactive, he also gets loged out but then the entry remain as "online".. :)

Link to comment
Share on other sites

I see now. that one is complicated. do you want to consider the user loged out after they leave your site? I am not sure how to do this. there is probably a way. If i were you I would just look at the time they last visited a page on your site. that would be close to the time they would log out.Edit: Try and get the source of a php forum. take a look at how they do it.

Link to comment
Share on other sites

Forums like this keep track of who is online by a timer. Once you click a link, you are "online" for the next 5 or 10 minutes, if you click another link the timer gets reset. If time passes and you don't click on anything, you are considered not to be online.

Link to comment
Share on other sites

I got another idea. go to the yabb forum. ask in the programing section. many of the people that work on the actual yabb forum also answer questions. they could probably tell you how they do the online/offline thing. I think they use perl but you could probably do it a similar way using php. here is another idea. you could use somethign like "Inactive" if the user hasnt viewed a page in the last hour or something. just make a script to check the last page view time.Edit: i just hate it when i am posting a message and someone slips their post in first. o well

Link to comment
Share on other sites

It is just that I should be able to determine whenever they are offline, thats all. I already have the manual logout possibility, but now the automatic one yet that may override the manual one (or the other way round).How can I do this then, the tracing of being online?

Link to comment
Share on other sites

You could add a field to the user table in the database that is something like last_action, some timestamp that you update every single time the user loads a page. You can update it when you check if they are logged in, and if they are update the field with the current timestamp. Then, you can select from the database users whose last action was in the last minute, or 5 minutes, or an hour or day or whatever you want.

Link to comment
Share on other sites

Well done, that actually is possible :) I have the possibility to do that, the previous sollutions weren't possible...I have an updatescript inside the loginsystem, that checks the user to have a valid user account every new page, so that would be the location to chack their doings :) thank you very much :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...