If you don't want one user to "clean up" after another user, you could set up a cron job that runs every five minutes and cleans up unused sessions. That would allow you to remove that "clean up" code from the sessions.php code, but would require an external process.
The up side is that you've removed code from sessions. The down side is that your clean up code runs 24x7, where sessions is only executed when someone is actually on your board. To be honest, there are never really that many rows in the sessions table... I don't think I would try to change it. If you are experiencing performance issues, an index on session_time would probably help. That's what's used in the delete query:
Code: Select all
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_time < $expiry_time
AND session_id <> '$session_id'";