PHP Session Handling Functions

EditRocket provides the following information on Session Handling functions in the PHP source code builder.

int session_cache_expire ([ int $new_cache_expire ] ) - session_cache_expire() returns the current setting of session.cache_expire.

string session_cache_limiter ([ string $cache_limiter ] ) - session_cache_limiter() returns the name of the current cache limiter.

-

bool session_decode ( string $data ) - session_decode() decodes the session data in data, setting variables stored in the session.

bool session_destroy ( void ) - In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted.

string session_encode ( void ) - session_encode() returns a string with the contents of the current session encoded within.

array session_get_cookie_params ( void ) - Gets the session cookie parameters.

string session_id ([ string $id ] ) - session_id() is used to get or set the session id for the current session.

bool session_is_registered ( string $name ) - Finds out whether a global variable is registered in a session.

string session_module_name ([ string $module ] ) - session_module_name() gets the name of the current session module.

string session_name ([ string $name ] ) - session_name() returns the name of the current session.

bool session_regenerate_id ([ bool $delete_old_session ] ) - session_regenerate_id() will replace the current session id with a new one, and keep the current session information.

bool session_register ( mixed $name [, mixed $... ] ) - session_register() accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name, session_register() registers the global variable with that name in the current session.

string session_save_path ([ string $path ] ) - session_save_path() returns the path of the current directory used to save session data.

void session_set_cookie_params ( int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly ]]]] ) - Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script.

bool session_set_save_handler ( callback $open , callback $close , callback $read , callback $write , callback $destroy , callback $gc ) - session_set_save_handler() sets the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other than those supplied by PHP sessions is preferred. i.e. Storing the session data in a local database.

bool session_start ( void ) - session_start() creates a session or resumes the current one based on the current session id that's being passed via a request, such as GET, POST, or a cookie.

bool session_unregister ( string $name ) - session_unregister() unregisters the global variable named name from the current session.

void session_unset ( void ) - The session_unset() function frees all session variables currently registered.

void session_write_close ( void ) - End the current session and store session data.