35 public function read($session_id) {
38 $query =
"SELECT * FROM {$this->db->getTablePrefix()}users_sessions WHERE session='$id'";
39 $result = $this->db->getDataRow($query);
50 public function write($session_id, $session_data) {
55 $query =
"REPLACE INTO {$this->db->getTablePrefix()}users_sessions 56 (session, ts, data) VALUES 57 ('$id', '$time', '$sess_data_sanitised')";
59 if ($this->db->insertData($query) !==
false) {
79 $query =
"DELETE FROM {$this->db->getTablePrefix()}users_sessions WHERE session='$id'";
80 return (
bool) $this->db->deleteData($query);
86 public function gc($max_lifetime) {
88 $life = time() - $max_lifetime;
89 $query =
"DELETE FROM {$this->db->getTablePrefix()}users_sessions WHERE ts < '$life'";
90 return (
bool) $this->db->deleteData($query);
open($save_path, $name)
Re-initialize existing session, or creates a new one.Called when a session starts or when session_sta...
if($guid==elgg_get_logged_in_user_guid()) $name
__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...
sanitize_string($string)
Sanitize a string for database use.
close()
Closes the current session.boolean
gc($max_lifetime)
Cleans up expired sessions.Sessions not updated for max_lifetime seconds are removed. boolean
read($session_id)
Reads the session data from the session storage, and returns the results.The session id...
destroy($session_id)
Destroys a session.The session id. boolean
if(!$collection_name) $id