Welcome to WebmasterWorld Guest from 188.8.131.52
My problem is now that I want to tell the difference between the two times, the last stored time and the current time, and if it's greater than 20 minutes, to show the user as logged out.
Here are the problems I run into, if the difference is less than 20 minutes but the difference between the two days is more than 1, I don't want to show the user as logged in, obviously.
I have the times currently stored in the strtotime() fashion.
Here's an example:
$lasttime = strtotime("-67 minutes"); // for instance
$currentdate = strtotime("now");
$lastact = date("Y-m-d g:i:s a", $lasttime);
$now = date("Y-m-d g:i:s a", $currentdate);
$daycheck = date("d", $now) - date("d", $lastact);
$minutecheck = date("i", $now) - date("i", $lastact);
If anyone can help me out, I would appreciate it.
$difference = $currentdate - $lasttime;
That gives you how long it's been in seconds. 20 minutes (60 seconds X 20) is 1200 seconds, so if the difference is greater then 1200, it's expired.