Skip to content

Instantly share code, notes, and snippets.

@mr5z
Last active November 17, 2016 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr5z/c52bb3af0d3b385a0f1e193da1f1ddb6 to your computer and use it in GitHub Desktop.
Save mr5z/c52bb3af0d3b385a0f1e193da1f1ddb6 to your computer and use it in GitHub Desktop.
<?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