36 public function read($session_id) {
39 $query =
"SELECT * FROM {$this->db->getTablePrefix()}users_sessions WHERE session='$id'";
40 $result = $this->db->getDataRow($query);
51 public function write($session_id, $session_data) {
56 $query =
"REPLACE INTO {$this->db->getTablePrefix()}users_sessions 57 (session, ts, data) VALUES 58 ('$id', '$time', '$sess_data_sanitised')";
60 if ($this->db->insertData($query) !==
false) {
80 $query =
"DELETE FROM {$this->db->getTablePrefix()}users_sessions WHERE session='$id'";
81 return (
bool) $this->db->deleteData($query);
87 public function gc($max_lifetime) {
89 $life = time() - $max_lifetime;
90 $query =
"DELETE FROM {$this->db->getTablePrefix()}users_sessions WHERE ts < '$life'";
91 return (
bool) $this->db->deleteData($query);
if($guid==elgg_get_logged_in_user_guid()) $name
open($save_path, $name)
Re-initialize existing session, or creates a new one.Called when a session starts or when session_sta...
sanitize_string($string)
Sanitize a string for database use.
read($session_id)
Reads the session data from the session storage, and returns the results.The session id...
gc($max_lifetime)
Cleans up expired sessions.Sessions not updated for max_lifetime seconds are removed. boolean
destroy($session_id)
Destroys a session.The session id. boolean
__construct(\Elgg\Database $db)
Constructor.
write($session_id, $session_data)
Writes the session data to the session storage.The session id. The encoded session data...
if(!$collection_name) $id
close()
Closes the current session.boolean