Kate (kate_nepveu) wrote,
Kate
kate_nepveu

Solved: PHP regular expression help

ETA: solved by [personal profile] avram!

I have this little Movable Type plugin for my booklog that runs a simple PHP script and stops very common spam from even getting into the MT interface. Except I can't figure out how to make it stop one particular kind of spam. I'm sure this is dead obvious to people who aren't cargo-culting their way through things, can anyone help?

So the plugin checks a text file called "rules.txt" that contains things like:

if (preg_match('@casino@i',$fields)) { exit('Your comment has been blocked as spam; rephrase it or e-mail the administrator.'); }

Meaning if "casino" appears in the name, e-mail, or URL fields of the submitted comment, then the website immediately returns a page with that text.

I'm getting a ton of spam comments of the form "Hello!" plus a new line. "preg_match('@^Hello!$@i',$body)" doesn't catch them. And I don't want to catch anyone that might be enthusiastic and have actual text follow their "Hello!", just the spammers who are adding a new line after.

What do I need to do?

comment count unavailable comment(s) | reply | link
Tags: help me internets
Subscribe

  • Sailor Moon Crystal

    I never saw the original. Should I be watching this? comment(s) | add comment ( how-to) | link

  • Pumpkin Scissors vol. 1 (anime)

    We watched the first DVD of the anime Pumpkin Scissors, episodes 1-4, last night. I've read the first volume of the manga, which the anime…

  • Pumpkin Scissors anime?

    I know people who like the Pumpkin Scissors manga, but I see it's an anime as well—how's that? I'm thinking it might be suitable Netflix…

Comments for this post were disabled by the author