[lp_client_isBot]

Description

Link: [lp_client_isBot]
Author: Bil Corry
Category: Client
Version: 8.x
License: Public Domain
Posted: Jan. 20, 2006
Updated: Feb. 25, 2009
More by this author...

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]

Parameters

-user_agent string, optional Processes user_agent to see if it's a bot. Default is to evaluate the current client.
-deny string, optional Returns true when matched, all else returns false.
-allow string, optional Returns false when matched, all else returns true.
-strict boolean, optional Returns true only for known bots.
-loose boolean, optional Returns true for known bots, suspected bots, and unknown clients.

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[

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

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net