Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

remove_dead_sessions.php 728B

12345678910111213141516171819202122232425
  1. <?
  2. //------------- Remove dead sessions ---------------------------------------//
  3. $AgoMins = time_minus(60 * 30);
  4. $AgoDays = time_minus(3600 * 24 * 30);
  5. $SessionQuery = $DB->query("
  6. SELECT UserID, SessionID
  7. FROM users_sessions
  8. WHERE (LastUpdate < '$AgoDays' AND KeepLogged = '1')
  9. OR (LastUpdate < '$AgoMins' AND KeepLogged = '0')");
  10. $DB->query("
  11. DELETE FROM users_sessions
  12. WHERE (LastUpdate < '$AgoDays' AND KeepLogged = '1')
  13. OR (LastUpdate < '$AgoMins' AND KeepLogged = '0')");
  14. $DB->set_query_id($SessionQuery);
  15. while (list($UserID, $SessionID) = $DB->next_record()) {
  16. $Cache->begin_transaction("users_sessions_$UserID");
  17. $Cache->delete_row($SessionID);
  18. $Cache->commit_transaction(0);
  19. }
  20. ?>