Link | lp_session_id |
Author | Bil Corry |
Category | Session |
Version | 8.x |
License | Public Domain |
Posted | 12 Feb 2006 |
Updated | 03 Dec 2007 |
More by this author... |
Retrieves all current Session IDs and returns them as HTML <input>s, URL strings or an array of pairs. Also can return the vars that hold the session ID(s).
Note that the XHTML option is automatically selected when the content-type is set to XHTML.
[ session_start: -name='test_session1', -uselink; session_start: -name='test_session2', -uselink; session_addvar: -name='test_session1', 'test1'; session_addvar: -name='test_session2', 'test2'; session_addvar: -name='test_session1', 'test3'; session_addvar: -name='test_session2', 'test4'; var:'test1'=123; var:'test2'=456; var:'test3'='abc'; var:'test4'='def'; var:'test5'='not stored in session'; var:'test6'='not stored in session'; ]links: link1 link2Sessions Example
Session IDs as reported by Lasso Session ID #1 = [session_id: -name='test_session1'] Session ID #2 = [session_id: -name='test_session2']
Session IDs as reported by lp_session_id ['[lp_session_id] = '][lp_session_id] ['[lp_session_id: -vars] = '][lp_session_id: -vars] ['[lp_session_id: -form] = '][output: (lp_session_id: -form)] ['[lp_session_id: -form, -xhtml] = '][output: (lp_session_id: -form, -xhtml)] ['[lp_session_id: -url] = '][lp_session_id: -url]
Session IDs added by Lasso (view source) forms:
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.
[ define_tag:'lp_session_id', -description='Retrieves all current Session IDs and returns them as HTML s, URL strings or an array of pairs.', -priority='replace', -encodenone, -optional='xhtml'; // xhtml? local:'serveXHTML' = false; if: local_defined:'xhtml' || (var:'_lp_xhtml') === true || $__http_header__->(contains:'xhtml'); #serveXHTML = true; /if; // session var names; local:'vars'= (string_findregexp: vars->keys, -find='_SessionTracker_[^\\)]*',-ignorecase); // how to output? if: params->(find:'-form')->size > 0 ; local:'format'='form'; else: params->(find:'-url')->size > 0 ; local:'format'='url'; else: params->(find:'-vars')->size > 0 ; local:'format'='vars'; else: params->(find:'-string')->size > 0 ; local:'format'='string'; else; local:'format'='array'; /if; // #sessions will be the output, of type (array) local:'sessions' = array; local:'session_name' = string; iterate: #vars, local:'session_varname'; if: !#session_varname->(endswith:'_vars') && #session_varname != '_SessionTracker_Result'; #session_name = (string:#session_varname)->(removeleading:'_SessionTracker_')&; // how to output? select: #format; case: 'form'; if: #serveXHTML; #sessions->(insert: ''); else; // HTML #sessions->(insert: ''); /if; case: 'url'; #sessions->(insert: '-session='+(encode_stricturl: #session_name)+':'+(encode_stricturl:(vars->find: #session_varname))); case: 'vars'; #sessions->(insert: #session_varname = (vars->find: #session_varname)); case: 'string'; #sessions->(insert: #session_name+'='+(vars->find: #session_varname)); case; // array #sessions->(insert: #session_name = (vars->find: #session_varname)); /select; /if; /iterate; if: #format=='string'; return: #sessions->(join:', '); /if; return: #sessions; /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft