Modding BlogCFC: Moderated if url is present
I've been getting some human posted spam to my blog and I want it to stop. The problem is, to stop a human you have to either moderate all posts, force a sign in to post or search the comment for one of a million odd keywords. None of those solutions appeal to me. Time to come up with something new.
Looking at the problem I see that almost all human posted spam involves a link to some outside resource. Ah, a pattern I can work with. If I can set moderation on for any comment that has a link, it would help block most human posted spam, at least in theory.
I can do this right or I can do it as a fast hack. As I don't have the time to do it right at the moment, I'm going to write a single regular expression and add it to the blog.cfc. I'll write myself a note to remember to go back and fix it correctly later.
The solution I came up with is to go to line 236 in the blog.cfc component and add in this line to the cfif statement:
This will force moderation on for any comment with a link in it. Great for stopping most form spam, great for letting most comments through, terrible for letting real comments with links through.
To do this properly I'd have to set a new variable in the blog.ini file to specify if I want to moderate based on urls. Then modify the initialization code for blogcfc to grab that variable along with all of the others. Once that's done, line 236 would be modified to look at the new variable to see if moderation should be on for the post. Rather straight forward.
One thing I noticed when writing this post is that I never posted my article on my technique to block all bot spam. I know I posted it somewhere, but I guess I never posted it here. I'll add a reminder to myself to do that as well. Oh, for a 48 hour day. :)


http://www.houseoffusion.com
http://www.mischefamily.com/nathan/index.cfm/2007/...
It has worked well for me, and for the most part it allows people to post on topic comments (like this one) without moderation.