Write session data to the SessionHandler backend.

@param   string   $session_id    The session identifier.
@param   string   $session_data  The session data.
@return  boolean  True on success, false otherwise.
966893
public function write($session_id, $session_data)
	{
		$this->files->put($this->path . DS . $session_id, $session_data, true);
	}
250116
public function read($session_id)
	{
		$key = $this->key($session_id);

		$this->expiration($key);

		return $this->engine->get($key);
	}
838970
function destroy($session_id)
    {

        // deletes the current session id from the database
        $result = $this->_mysql_query('

            DELETE FROM
                ' . $this->table_name . '
            WHERE
                session_id = "' . $this->_mysql_real_escape_string($session_id) . '"

        ') or die($this->_mysql_error());

        // if anything happened
        // return true
        if ($this->_mysql_affected_rows() !== -1) return true;

        // if something went wrong, return false
        return false;

    }
801833
public function write($sessionId, $value)
    {
        if (Config::get('session_user_loc') == 'db') {
            $this->handler->set(Config::get('session_user_loc_table'), [
                'id' => $sessionId,
                'value' => $value,
                'ctime' => Cml::$nowTime
            ], Config::get('session_user_loc_tableprefix'));
        } else {
            $this->handler->set(Config::get('session_user_loc_tableprefix') . Config::get('session_user_loc_table') . '-id-' . $sessionId, $value, $this->lifeTime);
        }
        return true;
    }
923803
public function write($id, $data)
    {
        if (!$data) 
            $this->getDbConnection()->executeQuery('DELETE FROM session_data WHERE id=?',[$id]);
            else $this->getDbConnection()->executeQuery('REPLACE INTO session_data SET timestamp=?, id=?, value=?',[time(),$id,$data]);
		return true;
    }
314188
public function write($session_id, $session_data)
	{
		$key = $this->key($session_id);

		if ($this->engine->get($key . '_expire'))
		{
			$this->engine->replace($key . '_expire', time());
		}
		else
		{
			$this->engine->set($key . '_expire', time());
		}
		if ($this->engine->get($key))
		{
			$this->engine->replace($key, $session_data);
		}
		else
		{
			$this->engine->set($key, $session_data);
		}

		return;
	}
390915
public function read($session_id)
	{
		// get session hash
		$session = $this->database->hgetall($this->key($session_id));

		// return session data
		return (isset($session['data'])) ? $session['data'] : null;
	}
1000123
public function write($id, $data)
    {
        $access = time();
        $this->session_id = (string) $id;
        $this->access = $access;
        $this->data = $data;
        $this->save();

        return true;
    }
252440
public function do_destroy($session_id)
    {
        $file = $this->_getFileName($session_id);

        if (file_exists($file)) {
            @unlink($file);
        }

        return true;
    }
1964
function read($session_id)
    {

        // get the lock name, associated with the current session
        $this->session_lock = $this->_mysql_real_escape_string('session_' . $session_id);

        // try to obtain a lock with the given name and timeout
        $result = $this->_mysql_query('SELECT GET_LOCK("' . $this->session_lock . '", ' . $this->_mysql_real_escape_string($this->lock_timeout) . ')');

        // if there was an error
        // stop execution
        if (!is_object($result) || strtolower(get_class($result)) != 'mysqli_result' || @mysqli_num_rows($result) != 1 || !($row = mysqli_fetch_array($result)) || $row[0] != 1) die('Session Worker: Could not obtain session lock!');

        //  reads session data associated with a session id, but only if
        //  -   the session ID exists;
        //  -   the session has not expired;
        //  -   if lock_to_user_agent is TRUE and the HTTP_USER_AGENT is the same as the one who had previously been associated with this particular session;
        //  -   if lock_to_ip is TRUE and the host is the same as the one who had previously been associated with this particular session;
        $hash = '';

        // if we need to identify sessions by also checking the user agent
        if ($this->lock_to_user_agent && isset($_SERVER['HTTP_USER_AGENT']))

            $hash .= $_SERVER['HTTP_USER_AGENT'];

        // if we need to identify sessions by also checking the host
        if ($this->lock_to_ip && isset($_SERVER['REMOTE_ADDR']))

            $hash .= $_SERVER['REMOTE_ADDR'];

        // append this to the end
        $hash .= $this->security_code;

        $result = $this->_mysql_query('

            SELECT
                session_data
            FROM
                ' . $this->table_name . '
            WHERE
                session_id = "' . $this->_mysql_real_escape_string($session_id) . '" AND
                session_expire > "' . time() . '" AND
                hash = "' . $this->_mysql_real_escape_string(md5($hash)) . '"
            LIMIT 1

        ') or die($this->_mysql_error());

        // if anything was found
        if (is_object($result) && strtolower(get_class($result)) == 'mysqli_result' && @mysqli_num_rows($result) > 0) {

            // return found data
            $fields = @mysqli_fetch_assoc($result);

            // don't bother with the unserialization - PHP handles this automatically
            return $fields['session_data'];

        }

        $this->regenerate_id();

        // on error return an empty string - this HAS to be an empty string
        return '';

    }
414965
public function getSessionData($session_id = '')
    {
        if (isset($this->objectSession) && $this->objectSession != NULL && is_object($this->objectSession)) {
            $this->logger->info(__FUNCTION__, 'Session with CI Session Class');
            if ($this->objectSession->has_userdata($session_id)) {
                return $this->objectSession->userdata($session_id);
            }
        } else {
            $this->logger->info(__FUNCTION__, 'Session with The Http Foundation Component');
            if ($this->session->has($session_id)) {
                return $this->session->get($session_id);
            }
        }

        return NULL;
    }
835848
public function write($sessionId, $sessionData){
        //si la sesión está abierta y tengo lock 
        if($this->opened){
            $sql= $this->connection->connection->prepare('REPLACE INTO sessions (session_id, session_data, session_expiration) VALUES(:id, :data, :expiration)');
            $sql->bindValue('id', $sessionId);
            $sql->bindValue('data', $sessionData);
            $fecha= new \DateTime();
            $fecha->add(new \DateInterval($this->expirationTime));
            $sql->bindValue('expiration', $fecha->format('Y-m-d H:i:s'));
            return $sql->execute() === TRUE;
        }
        else{
            return FALSE;
        }
    }
712806
public function session_read($session_id)
    {
        // Set empty result
        $this->session_data = (string)'';

        // Fetch session data from the selected database with the correct
        // timestamp
        $time       = (int)time();
        $session_id = mysql_real_escape_string($session_id);
        $sql        = (string)"SELECT `session_data` FROM `{$this->_db_name}`.`user_session` WHERE `session_id` = '$session_id' AND `expires` > $time";

        $session_res = $this->db->query((string)$sql);
        // if no session data exists return false
        if (empty($session_res)) return false;
        $this->session_data = $this->db->fetch_string($session_res);
        $this->db->free($session_res);

        // session data is set uncompressed
        return $this->session_data;
    }
862607
public function session_write($session_id, $session_data)
    {
        // set the garbage collection timestamp
        $time = (int)time() + (int)$this->_session_life_time;
        // bzip the data
        // replace the whole session_data
        $session_id   = mysql_real_escape_string($session_id, $this->db->db);
        $session_data = mysql_real_escape_string($session_data);
        $date         = date('Y-m-d H:i:s');

        $sql = (string)"REPLACE INTO `{$this->_db_name}`.`user_session` (`session_id`,`session_data`,`expires`, `created`, `updated`) VALUES ('$session_id','$session_data', $time , '$date', '$date')";
        if (!$this->db->query($sql)) return false;

        $this->session_id = (string)$session_id;

        return true;
    }
32222
public function write($id, $data): bool
    {
        DB::table('session')->updateOrInsert([
            'session_id' => $id,
        ], [
            'session_time' => Carbon::now(),
            'user_id'      => (int) Auth::id(),
            'ip_address'   => $this->request->getServerParams()['REMOTE_ADDR'] ?? '127.0.0.1',
            'session_data' => $data,
        ]);

        return true;
    }
1070625
public function write($session_id, $session_data)
    {
        // When create the new session record
        if (! $this->sessions()->where('id', $session_id)->exists()) {
            $insert = $this->sessions()
                ->insert($this->data($session_id, $session_data));

            return $insert == 1;
        }

        // Update the session information
        $update = $this->sessions()->where('id', $session_id)->update([
            'data' => $session_data,
            'id' => $session_id
        ]);

        return $update == 1;
    }
143413
function write($session_id, $session_data)
    {

        // insert OR update session's data - this is how it works:
        // first it tries to insert a new row in the database BUT if session_id is already in the database then just
        // update session_data and session_expire for that specific session_id
        // read more here http://dev.mysql.com/doc/refman/4.1/en/insert-on-duplicate.html
        $result = $this->_mysql_query('

            INSERT INTO
                ' . $this->table_name . ' (
                    session_id,
                    hash,
                    session_data,
                    session_expire
                )
            VALUES (
                "' . $this->_mysql_real_escape_string($session_id) . '",
                "' . $this->_mysql_real_escape_string(md5(($this->lock_to_user_agent && isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') . ($this->lock_to_ip && isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '') . $this->security_code)) . '",
                "' . $this->_mysql_real_escape_string($session_data) . '",
                "' . $this->_mysql_real_escape_string(time() + $this->session_lifetime) . '"
            )
            ON DUPLICATE KEY UPDATE
                session_data = "' . $this->_mysql_real_escape_string($session_data) . '",
                session_expire = "' . $this->_mysql_real_escape_string(time() + $this->session_lifetime) . '"

        ') or die($this->_mysql_error());

        // if anything happened
        if ($result) {

            // note that after this type of queries, mysqli_affected_rows() returns
            // - 1 if the row was inserted
            // - 2 if the row was updated

            // if the row was updated
            // return TRUE
            if (@$this->_mysql_affected_rows() > 1) return true;

            // if the row was inserted
            // return an empty string
            else return '';

        }

        // if something went wrong, return false
        return false;

    }