Lasso Soft Inc. > Home

[lp_client_isBot]

Linklp_client_isBot
AuthorBil Corry
CategoryClient
Version8.x
LicensePublic Domain
Posted20 Jan 2006
Updated25 Feb 2009
More by this author...

Description

Returns true if client is a bot, spider, validator, robot or crawler.  It's based on user-agent, so it won't identify any bot that doesn't identify itself via the user-agent.

Requires [lp_client_browser]

Sample Usage

if: lp_client_isBot;
'Hello automated friend!';
/if;

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_client_isBot',
	-description='Returns true if client is a bot, spider, validator, robot or crawler.',
	-priority='replace',
	-optional='user_agent', // test a user agent string
	-optional='deny',       // returns true when code matches, all else reported false
	-optional='allow',      // returns false when code matches, all else reported true
	-optional='strict',     // only return true for known bots
	-optional='loose';      // true for known bots and suspected bots and unknown clients

	if: local_defined:'user_agent';
		local:'client_browser' = #user_agent;
	else;
		local:'client_browser' = client_browser;
	/if;

	local:'typecode' = 'CDEFLORSVX'; // default

	if: local_defined:'strict';
		local:'typecode' = 'CDEFLORSV';
	else: local_defined:'loose';
		local:'typecode' = 'CDEFLORSUVX';
	else: local_defined:'deny';
		local:'typecode' = (string: #deny);
	else: local_defined:'allow';
		local:'typecode' = 'BCDEFLMOPRSUVX';
		iterate: (string: #allow), local:'chr';
			#typecode->(remove: #typecode->(find: #chr), 1);
		/iterate;
	/if;

	return: #typecode->(contains: (lp_client_browser: #client_browser)->(find:'typecode'));

/define_tag;

]

Comments

No comments

Please log in to comment

LassoSoft Inc. > Home

 

 

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