If you are using apache, .htaccess is your friend. It will use fewer resources 
because it can stop a request before it even reaches ColdFusion.
mf

 -----Original Message-----
From:   Derrick Peavy [mailto:[email protected]]
Sent:   Wednesday, August 24, 2011 06:28 PM Eastern Standard Time
To:     [email protected]
Subject:        Re: [ACFUG Discuss] Best way to handle chunk of CFIF statements

Cameron,

Quick answer:  In that example, and in the code, it's not the same searchTerm. 
(i.e.: 'Purebot', 'proxy', 'misuga' 'google').  The example looks for this 
substring inside the user agent (keeping in mind that the user agent can be 
faked of course).  Bots known to cause problems are tracked and timed 
differently. Good bots are logged for other reasons. Users deemed to be human 
are logged. Reasons why that data is needed is another matter.  My feeling is 
that there has to be a better way to do it. 

So, Looking over Ajas' link now and cf411 as well. 


__________________
Derrick Peavy
[email protected]
404-786-5036

“Innovation distinguishes between a leader and a follower.” - Steve Jobs
"In economics, the majority is always wrong." - John Kenneth Galbraith
_____________________




On Aug 24, 2011, at 5:21 PM, Cameron Childress wrote:


        Are you always finding the string in a subset of the 
"cgi.http_user_agent" string or is it an exact match?

        -Cameron
        
        
        On Wed, Aug 24, 2011 at 5:06 PM, Derrick Peavy 
<[email protected]> wrote:
        

                Looking for a clever solution to this problem.

                I have some code on a site that checks for known spiders/bots 
and malicious user agents.   The list of "known" is baout 50 or so long. 

                One solution could be:

                (findNoCase('#searchTerm#', cgi.http_user_agent)) OR 
                (findNoCase('#searchTerm#', cgi.http_user_agent)) OR 
                (findNoCase('#searchTerm#', cgi.http_user_agent)) OR ... etc 
and so on, 50 times.

                Another solution could be:
                <cfif findNoCase('#searchTerm#', cgi.http_user_agent)>do 
something</cfif> and repeat that complete CFIF 50 times.

                What is a creative way to solve this without so many IF's and 
minimal processing? 

                Alos, the list of user agents can be either file based or 
pulled from a DB. I've done it both ways and I have used both solutions above. 
Don't see a difference, but it just seems rather crude. 
                                                                                
                __________________
                Derrick Peavy
                [email protected]
                404-786-5036

                “Innovation distinguishes between a leader and a follower.” - 
Steve Jobs
                "In economics, the majority is always wrong." - John Kenneth 
Galbraith
                _____________________

                                                                                
                





        -- 
        Cameron Childress
        --
        p:   678.637.5072
        im: cameroncf
        
        facebook <http://www.facebook.com/cameroncf>  | twitter 
<http://twitter.com/cameronc>  | google+ 
<https://profiles.google.com/u/0/117829379451708140985> 
        




Reply via email to