when you need a hammer, use a hammer
Date: 11/28/07
(PHP Community) Keywords: spam
I have a form that people have been trying to spamalot, so I thought hmm some bad words should never show up in certain places, so if they are there it has to be spam.
Here is what I have:
$bad_words = array('href','http','url');
if (in_array($foo=$_POST["name"], $bad_words, true)){
die ('SPAM not sent');
exit;
}
if (in_array($foo=$_POST["company"], $bad_words, true)){
die ('SPAM not sent');
exit;
but I would get "parse error, unexpected T_BOOLEAN_OR in form on line" that had this:
if (in_array($foo=$_POST["name"], $bad_words, true))||(in_array($foo=$_POST["company"], $bad_words, true)){
and I do not know why (other than its been a long day and cant see strait).
Any hints?
Source: http://community.livejournal.com/php/599664.html