[session_save]

Description

Link: [session_save]
Author: Göran Törnquist
Category: Session
Version: 8.x
License: Public Domain
Posted: Nov. 30, 2009
Updated: Nov. 30, 2009
More by this author...

Session_save forces the built-in session manager to save the named session. This is great when you're using either file_serve, url_redirect or any other tag that aborts your request as the last thing to do. This way, the session will get saved in the current state anyway.

It has been tested with Lasso Professional 8.5.6, but should work well with any version from 8.x and later.

It supports both the sqlite and the in-memory driver provided with Lasso. It has not been tested with an external session database.

The tag was originally written by Fletcher Sandbeck of Lassosoft. I merely changed to parenthesis syntax and made it compliant with syntax accepted by Lasso 9.

Parameters

-name string, required

Sample Usage

session_save('my_session_name');
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?LassoScript 
define_tag('save', -namespace='session_', -priority='replace',
        -req = 'name', -type='string'
);
    // Lasso 8 only var saver
    if(var_defined('_SessionTracker_' + #name));
        local(
        	'id'	= var('_SessionTracker_' + #name),
        	'store'	= map,
        	'i'		= null
        );
        iterate(var('_SessionTracker_' + #name + '_Vars'), #i);
            #store->insert( #i = @var(#i));
        /iterate;
        $_session_driver->saveData('_SessionTracker_' + #name + '_' + #id, #store->serialize);
    /if;
/define_tag;	
?>

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net