Click here to Skip to main content
16,017,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Tracking users login/logout times on my site in php? and maintain day by day login,logout activity time in database using php mysql? I want php coding are any ody suggest me for any tutorials. 


What I have tried:

I have registered for particular registration for users.
Posted
Updated 2-Aug-16 0:59am

1 solution

You can start with PHP: MySQL Database[^] and PHP: MySQL Functions - Manual[^]

Now, if you're handling the logins and logouts, then you already know how to do the above. If you're just creating webpages, you need to (1) learn SQL so you can (2) have a method of checking login credential; and you can easily record the login value then, if successful.

As for log-out, do you assume they'll use a logout button or something? If they did, you could use that to send an insert or update query to MySQL table. But, of course,they may just change the page or shut their browser. You can trap the first as, for example, an unload [^] event - but if they go to another page on your site, what do you do? You need to carry their logged-in state around with the pages (by session or in the URL). What if they leave your pages for another site and then reconnect?

You'll likely also want to learn AJAX[^]

With local applications, this wasn't so bad. With the internet, you've a lot to think about as you (server side) lose much (or all) control over the client side/state.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900