DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • April 21, 2018, 10:04:58 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Time between two log ons  (Read 2029 times)
0 Members and 1 Guest are viewing this topic.
Exxar
Guest
« 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:

Code:
$laston=$session['user']['laston'];
$laston=convertgametime(strtotime($laston));
$time=gametime();
$timediff=$time-$laston;
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: May 30, 2005, 10:45:39 AM »

Nope.
Code:
$session['loggedin']=true;
$session['output']=$session['user']['output'];
$session['laston']=date("Y-m-d H:i:s");
//some misc code
$session['user']['laston'] = date("Y-m-d H:i:s");
login.php.

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.
« Last Edit: May 30, 2005, 10:46:55 AM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
23 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search