Lasso Soft Inc. > Home

[lp_session_redirect]

Linklp_session_redirect
AuthorBil Corry
CategorySession
Version8.x
LicensePublic Domain
Posted12 Feb 2006
Updated12 Feb 2006
More by this author...

Description

Redirects to a target site and includes the current session(s), if any.

Note that if you don't have any active sessions, you can still safely use this tag, it will work exactly like redirect_url.

Also note that if you do have sessions and you're redirecting to outside your website, be sure to either use redirect_url instead, or know that you'll be passing the session IDs too.

Requires [lp_session_id]

Sample Usage

[

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';

]
Sessions 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:
links: link1 link2
Redirect Test [ if: (action_param:'r') == '1'; redirect_url:'sessiontest.lasso'; else: (action_param:'r') == '2'; lp_session_redirect:'sessiontest.lasso'; /if; 'Normal redirect\r\n'; 'Session redirect\r\n'; ]
Session Vars All Sessions = [lp_session_vars] Session ID #1 = [lp_session_vars: 'test_session1'] Session ID #2 = [lp_session_vars: 'test_session2']

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.

[

define_tag:'lp_session_redirect',
	-description='Redirects to a target site and includes the current session(s), if any.',
	-priority='replace',
	-required='url';

/*

	Note that if you don't have any active sessions, you can still safely use this tag, it will work exactly like redirect_url.
	Also note that if you do have sessions and you're redirecting to outside your website, be sure to either use redirect_url instead, or know that you'll be passing the session IDs too.
	
*/

	local:'sessions' = (lp_session_id: -url)->(join:'&');
	local:'target' = string;
	local:'anchor' = string;

	// does the URL already have parameters? 
	if: #url->(contains:'?');
		local:'symbol' = '&';
	else;
		local:'symbol' = '?';
	/if;

	// does URL have an anchor?
	if: #url->(contains:'#');
		local:'split' = #url->(split:'#');
		#anchor = '#' (#split->(get:2));
		#target = #split->(get:1);
	else;
		#target = #url;
	/if;	

		// --debug--
		// return: (#target #symbol #sessions #anchor);
		
	// redirect to the URL 
	redirect_url: (#target #symbol #sessions #anchor);

/define_tag;

]

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft