View Full Version : Subtract time?
RyanB88
04-22-2008, 02:17 AM
Ok so I have a script and I have in a db the last time a session had any activity, I want to take the current time DATE("H:i:s"); and subtract 10 minutes from it than compare it to the time of last activity stored in the db, if the current time minus 10 minutes is greater than or equal to the time of last activity stored in the db, the script would not let the command go though and would remove the entry in the sessions table.
flynch01
04-22-2008, 02:27 AM
Like a how many users is online thing? I don't know if the DATE part is important for anything else. But you can store the value of time() in the database. And then just do
$check = time() - $databaseresult['Time'];
if ($check >= 3600) {
// Delete the entry here
}
That'll remove the user in an hour. What you wanted?
RyanB88
04-22-2008, 02:42 AM
Actually I was looking for only 10 minutes, but thats simple enough to modofy just change if ($check >= 3600) { to if ($check >= 600) {
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.