english/libraries/joomla/session/storage/database.php
/**
	 * Write session data to the SessionHandler backend.
	 *
	 * @param   string   The session identifier.
	 * @param   string   The session data.
	 *
	 * @return  boolean  True on success, false otherwise.
	 * @since   11.1
	 */
Write session data to the SessionHandler backend.
@param   string   The session identifier.
@param   string   The session data.

@return  boolean  True on success, false otherwise.
Write session data to the SessionHandler backend . @param string The session identifier . @param string The session data . @return boolean True on success false otherwise .
public function write($id, $data)
	{
		$db = JFactory::getDbo();
		if (!$db->connected()) {
			return false;
		}
		$db->setQuery(
			'UPDATE `#__session`' .
			' SET `data` = '.$db->quote($data).',' .
			'	  `time` = '.(int) time() .
			' WHERE `session_id` = '.$db->quote($id)
		);
		if (!$db->query()) {
			return false;
 		}
		if ($db->getAffectedRows()) {
			return true;
		} else {
			$db->setQuery(
				'INSERT INTO `#__session` (`session_id`, `data`, `time`)' .
				' VALUES ('.$db->quote($id).', '.$db->quote($data).', '.(int) time().')'
			);
			return (boolean) $db->query();
		}
	}
public function write ( $ id , $ data ) { $ db = JFactory :: getDbo ( ) ; if ( ! $ db -> connected ( ) ) { return false ; } $ db -> setQuery ( 'UPDATE `#__session`' . ' SET `data` = ' . $ db -> quote ( $ data ) . ',' . '	  `time` = ' . ( int ) time ( ) . ' WHERE `session_id` = ' . $ db -> quote ( $ id ) ) ; if ( ! $ db -> query ( ) ) { return false ; } if ( $ db -> getAffectedRows ( ) ) { return true ; } else { $ db -> setQuery ( 'INSERT INTO `#__session` (`session_id`, `data`, `time`)' . ' VALUES (' . $ db -> quote ( $ id ) . ', ' . $ db -> quote ( $ data ) . ', ' . ( int ) time ( ) . ')' ) ; return ( boolean ) $ db -> query ( ) ; } }
Write session data to the SessionHandler backend.
Write session data to the SessionHandler backend .
// Get the database connection object and verify its connected. // Try to update the session data in the database table. // If the session does not exist, we need to insert the session.