/** * Check for existing session with id $sid * @param string $sid * @return boolean true if session found. */ public function session_exists($sid) { global $CFG; try { $sql = "SELECT * FROM {sessions} WHERE timemodified < ? AND sid=? AND state=?"; $params = array(time() + $CFG->sessiontimeout, $sid, 0); return $this->database->record_exists_sql($sql, $params); } catch (dml_exception $ex) { error_log('Error checking existance of database session'); return false; } }