cvs: php-bugs-web / bug.php /include functions.inc

From: Date: Tue, 29 Mar 2005 10:13:58 +0000
Subject: cvs: php-bugs-web / bug.php /include functions.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-27779@lists.php.net to get a copy of this message
philip Tue Mar 29 05:13:58 2005 EDT Modified files: /php-bugs-web/include functions.inc /php-bugs-web bug.php Log: Add a primitive spam link check. http://cvs.php.net/diff.php/php-bugs-web/include/functions.inc?r1=1.144&r2=1.145&ty=u Index: php-bugs-web/include/functions.inc diff -u php-bugs-web/include/functions.inc:1.144 php-bugs-web/include/functions.inc:1.145 --- php-bugs-web/include/functions.inc:1.144 Sun Mar 27 01:46:43 2005 +++ php-bugs-web/include/functions.inc Tue Mar 29 05:13:55 2005 @@ -13,6 +13,15 @@ } } +/* Primitive check for SPAM. Add more later. */ +function is_spam($string) +{ + if (substr_count(strtolower($string), 'http://') > 5) { + return true; + } + return false; +} + /* scrub user input so it can be re-output */ function clean($in) { http://cvs.php.net/diff.php/php-bugs-web/bug.php?r1=1.71&r2=1.72&ty=u Index: php-bugs-web/bug.php diff -u php-bugs-web/bug.php:1.71 php-bugs-web/bug.php:1.72 --- php-bugs-web/bug.php:1.71 Sun Mar 6 11:07:36 2005 +++ php-bugs-web/bug.php Tue Mar 29 05:13:57 2005 @@ -96,6 +96,9 @@ if (!$ncomment) { $errors[] = "You must provide a comment."; } + if (is_spam($ncomment)) { + $errors[] = "Please do not SPAM our bug system."; + } if (!$errors) { $query = "INSERT INTO bugdb_comments (bug,email,ts,comment) VALUES" @@ -113,6 +116,9 @@ if (!$ncomment) { $errors[] = "You must provide a comment."; } + if (is_spam($ncomment)) { + $errors[] = "Please do not SPAM our bug system."; + } # check that they aren't being bad and setting a status they # aren't allowed to (oh, the horrors.)

« previous php.mirrors (#27779) next »