i’m creating a script that will tag members whenever they login with the last logon date, what’s the most reliable method of comparing the time that has elapsed since their last login?
important: the end user won’t see any of this, i want to be able to determine if they have logged in within 7 days of their last login date. so this will be a recurring check, not a one time check.
i intend to call time() and store it, and then when they login again get the new time().
so i’d end up with $prev_login and $cur_login for example.
but how would i subtract the old and new and get an integer representing how many days have elapsed?
so it would be something like this:
function DaysElapsed($cur_login,$prev_login){
$elapsed = $cur_login – $prev_login;
/* code to convert $elapsed to days
return $elapsed;
}