DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: Exxar on May 30, 2005, 10:36:12 AM

Title: Time between two log ons
Post by: Exxar on May 30, 2005, 10:36:12 AM
I am writing a module that needs to check (upon logging in) when was that user logged in for the last time, to calculate the time difference between the two sessions.

Is there a modulehook that happens before modifying $session['user]['laston'] for the first time after logging in?

If not, do you have any suggestions how should I execute this calculation?

The calculation I had in mind looks like this:


Title: Re:Time between two log ons
Post by: Sichae on May 30, 2005, 10:45:39 AM
$session['laston']=date("Y-m-d H:i:s");
//some misc code
$session['user']['laston'] = date("Y-m-d H:i:s");

There are two hooks that you can use:
  • player-login
  • player-logout
player-login occurs after the modification of the laston. But, you may still use the two different values for calculation. Just store it in a pref at player-logout, and then check it against the new laston at player-login... if different, then do your calculation.

Have fun.

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines