Hey guys,
I have the following code to block the word “Aloha” on my site’s guestbook. Now I’m getting spam containing a few other words, such as Viagra and other various prescriptions.
Is there an easier way to write this code?
[code=php]if ((preg_match(“/Aloha/”, $message)) || (preg_match(“/Viagra/”, $message)) || (preg_match(“/Cialis/”, $message)))
{
$errors[] = “This looks like spam. If it is, **** off.”;
}
I’m clearly a noob at PHP, but trying to learn (that why I’m writing my own guestbook thing when I know that there’s better solutions out there). I need the practice. I also know that there’s better ways to prevent spam, but I get maybe 2 posts a month and 6 spam posts, so it won’t be tough to update the list of blocked words.
Any help/criticism is appreciated. Thank you!