Gubbins Posted January 15, 2010 Share Posted January 15, 2010 I am trying to add some php to give me total time online to a players profile, I will need to add a database entry to keep track of this, but again i need advise on this please. Ok so the code on the players profile will be something like this:- <tr> <td align="center" class="sub" colspan="5">Total time online</td> </tr> <tr> <td align="center" class="tbl" colspan="5"><? print $????; ?></td> </tr But i have no idea of how to add days, hours and minuets. Can anyone please help? Kinds regards Gubbins Link to comment https://forums.phpfreaks.com/topic/188610-total-time-online/ Share on other sites More sharing options...
rpmorrow Posted January 15, 2010 Share Posted January 15, 2010 You need to add some code to the login script which stores the current timestamp in the DB or in a session variable. e.g. $_SESSION['loginTime'] = time(); Then the logout script should get the time again and subtract the previous number. This would give you the time in seconds for that session. You would then need to add the code for adding previous times from the DB Link to comment https://forums.phpfreaks.com/topic/188610-total-time-online/#findComment-995769 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.