You don't really mean the code looks like that (where the #searchterm# is repeated), do you? Because that doesn't seem to make sense. Maybe it was pseudo code and you left something out.
But I will say this: I wrote a UDF (posted at cflib and since tweaked by others) that may help you: http://www.cflib.org/index.cfm?event=page.udfbyid <http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=1908> &udfid=1908 It's not long or complicated, but it solves what was for me a problem very similar to yours, and it surprised me (as it may you) that CFML didn't make it easier. Check it out. If nothing else, it may give you an idea to consider in a variation for your own need. All that said, I will note as well that there are other solutions out there for the common problem of handling spiders and bots. Besides the link that Ajas offered, consider also my tools of that sort at http://www.cf411.com/injectprotect. While those focus on sql injection protection (at various levels up/down the stack from CFML to hardware), some of them also offer protection for spiders. /charlie From: [email protected] [mailto:[email protected]] On Behalf Of Derrick Peavy Sent: Wednesday, August 24, 2011 5:06 PM To: [email protected] Subject: [ACFUG Discuss] Best way to handle chunk of CFIF statements 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 _____________________ ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
