iam thinking if theres a possibilities that i can put a time in time out on my PHP
if you log in thats the time you time in and if you log out thats the time out is that possible??

if yes how??

anyone can help me??
THANKS IN ADVANCE

Recommended Answers

All 4 Replies

actually iam not begging for help im only asking if that is possible

Member Avatar for LastMitch

@yumyam09

iam thinking if theres a possibilities that i can put a time in time out on my PHP
if you log in thats the time you time in and if you log out thats the time out is that possible??

I'm a bit confused. Are you talking about Employee Timesheet?

Yes , it is possible.

First you create a table for saving login time, an unique id and log out time.

When a user login creates a unique id and save it in a session.

Then insert the login time and unique id to the table.

When user logged out, takes unique id session and updates this table with this session and logged out time. After updating, unset session.

Then you will get login time and logout time.

The uproach that Bachov shared can do the work. Of course there could be many variations to it, no need to match session id with the log in id , if you have an architecture that provides different log in ids for each user , and therefore no reason to delete session after log out.

But to be honest it is one of the issues that the solution has to do with how really you mean the “log out” and how important is this for your app. Most users will not even push a log out button, or they will close the tab, the window, the browser or even let it open until session expires (don’t think about onunload event) . So if you really mean it that you want to know the log in time there is a cost to that, for example an AJAX call every x seconds just saying that me with log in id X I am still here.

I am one of those that really anxious of how WebSockets will change the way we work. If we suppose that this technology is available to anyone through any browser, in the same way, then these tasks can be done through that , without even the use of AJAX . How big the cost will be is just a debating subject ( I have done my tests so far but I don’t have a definite answer since this is just emerging).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.