I use a custom tag that was used to prevent cross site scripting called
cf_inputfilter by Peter Muzila. The same concept could probably be used for
what you are talking about. Instead of removing keywords it could find,
replace, and notify as well.
Dave
Put this code in Application.cfm
<cfmodule
template="customTags/inputfilter.cfm"
scopes = "FORM,COOKIE,URL"
chars = "),(,%,&,$,*,<,>,;"
tags =
"SCRIPT,OBJECT,APPLET,EMBED,FORM,LAYER,ILAYER,FRAME,IFRAME,FRAMESET,PARAM,ME
TA,TABLE,TD,TH,TR,HEAD,BODY,FONT,A,IMG,B,U,I,OL,UL">
Here is the code for the tag. I have posted it without permission since I
couldn�t find a way to contact the author. It was a free tag that was
available in the developers exchange.
<cfsilent>
<!---
Template: inputfilter.cfm
Author: Peter Muzila
Source Control: $Header: $
Description:
The cf_inputFilter tag removes characters or tags from all
fields coming from the
specified scopes (form,cookie, or url). This tag can be
placed in the Application.cfm
file to filter out any input coming thru these scopes to any
of the templates belonging
to the application.cfm file.
This tag can be executed only with CF 4.5 or higher
Usage:
<cf_inputFilter
scopes = "[FORM][,COOKIE][,URL]"
chars = "list_of_chars"
tags = "ALL|list_of_tags"
>
Attributes:
scopes (string list, required) - comma-delimited list of
input scopes to be filtered
chars (string, optional) - string containing set of
characters to be filtered out from the
input scope
tags (string list, optional) - comma-delimited list of tag
names to be filtered out from the
input scope
--->
<!--- attributes validation --->
<cfparam name="attributes.scopes">
<cfparam name="attributes.chars" default="">
<cfparam name="attributes.tags" default="">
<cfscript>
// prepare reg expression for the tag search
reTags = "" ;
if ( attributes.tags eq "ALL" )
// re for any tag - "<*>"
reTags = "<[^>]*>" ;
else if ( attributes.tags neq "" )
// re for any of the listed tags - "<tag1|tag2|...|tagN>"
reTags = "</?(#ListChangeDelims(attributes.tags, '|', ','
)#)[^>]*>" ;
// get comma-delimited list of chars from char set
charList = attributes.chars;
</cfscript>
<cfloop list="#attributes.scopes#" index="scopeName">
<cfif not findnocase("multipart/form-data",cgi.CONTENT_TYPE)>
<cfscript>
// get the handle for the scope (form, cookie, url)
s = Evaluate( scopeName ) ;
// scroll thru fields in the scope and handle only
simple values
for ( field in s )
if ( IsSimpleValue( s[field] ) ) {
// replace tags
if ( reTags neq '' )
s[field] = REReplace(
s[field], reTags, "", "ALL" ) ;
// replace chars
if ( charList neq '' )
s[field] = ReplaceList(
s[field], charList, "" ) ;
}
</cfscript>
</cfif>
</cfloop>
</cfsilent>
On 11/18/04 2:35 PM, "Jake" <[EMAIL PROTECTED]> wrote:
> Oops... sorry to have kicked off an off-topic discussion. Yipes!
>
> So the least I can do is start a thread dedicated to the CF issue at hand.
>
> Ken, yes, I think your app is a terrific idea. I don't personally need
> something as big as what you're talking about, as I don't host sites or
> own enough sites that are controlled by people besides me.
>
> But...
>
> What about if you could go as big as a multi-million site network or a
> single site, or anywhere in between and do the same thing. I'd have
> interest in doing things like watching my sites (blogs, forums, user
> submitted content) for content both in a database and statically for
> certain keywords or phrases.
> I only have a few sites I run, but they have a number of areas I don't
> control:
>
> - Forums
> - Blog commenting
> - Bug Tracker
>
> It'd be great to have an app that you could set key words on and send
> out a spider to tell you whether people are cussing, or using
> threatening language, or talking about a certain product or subject, or
> whatever.
>
> Interesting idea!
>
> ----------------------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To unsubscribe:
> http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
> http://www.dfwcfug.org/form_MemberRegistration.cfm
>
>
--
C: Zanzeta, Inc.
N: Dave Livingston
T: Chief Information Officer
P: 469.688.4872
F: 214.292.8578
E: [EMAIL PROTECTED]
--
----------------------------------------------------------
To post, send email to [EMAIL PROTECTED]
To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm