note 53249 deleted from function.substr by bobby

From: Date: Thu, 14 Sep 2006 17:16:59 +0000
Subject: note 53249 deleted from function.substr by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117170@lists.php.net to get a copy of this message
Note Submitter: michiel at mb-it dot nl ---- Loads of spam messages in a guestbook I created forced me to create a new boolean-function using the substr in order to check for unwanted words in posted messages. Take for instance the bad word is "poker": function checkword($string,$word) { $count = 0; for($i=0;$i<=strlen($string);$i++) { if (strtolower(substr($string,$i,strlen($word))) == strtolower($word)) { $count++; } } if ($count>0) { return true; } else { return false; } } $badword = "poker"; if (!checkword($mytext,$badword)) { addtoguestbook(); }

« previous php.notes (#117170) next »