Last active
November 17, 2016 09:57
-
-
Save mr5z/c52bb3af0d3b385a0f1e193da1f1ddb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function updateUsersStatus() { | |
global $db; | |
$sql = "UPDATE users SET users.active = false WHERE users.lastSeenActive = NOW() - INTERVAL 10 SECOND"; | |
$result = $db->query($sql); | |
if ($result) { | |
// we don't care about the result | |
} | |
else { | |
// something went wrong so ignore as well | |
} | |
} | |
updateUsersStatus(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment