spam - Checking form submission against a word list -


i have code check form being spammed , if stop email.

it includes section this:

if(strpos($messagefield, " cialis") !== false){ $noemail = true; } if(strpos($messagefield, " viagra") !== false){ $noemail = true; } 

etc many words have in bad word list

this works fine, clumsy , difficult add new words check. easier if create array , check field against array, strugling find example use (most examples still specify text search defeats object in case)

can code check $messagefield against array?

(i know there better ways maybe works @ moment!)

$i = 0; $wordlist = array(' cialis', ' viagra');  while ($i < count($wordlist) && $noemail == false) {   if (strpos($messagefield, $wordlist[$i]) !== false) {     $noemail = true;   }   $i++; } 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -