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

  • Captain America: Civil War (spoilers)

    Reactions only: I think it was . . . pretty good? The political discourse was a bit lower than Winter Soldier: better than many pop culture things…

  • should I see Captain America: Civil War?

    It's now out in at least two non-US countries, so, Internet who knows me and has seen it/reads spoilers, should I see it? I originally thought I…

  • the MCU can usually tempt me to post

    because it won't take long and I can't do anything involved at this very moment. See the spoiler-riffic summary of concept art from Doctor Strange…

Comments for this post were disabled by the author