cvs: php-master-web /entry user-note.php

From: Date: Sat, 10 Feb 2007 03:39:27 +0000
Subject: cvs: php-master-web /entry user-note.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-34191@lists.php.net to get a copy of this message
philip Sat Feb 10 03:39:27 2007 UTC Modified files: /php-master-web/entry user-note.php Log: More SPAM checking: bbcode links, and too many http://'s http://cvs.php.net/viewvc.cgi/php-master-web/entry/user-note.php?r1=1.62&r2=1.63&diff_format=u Index: php-master-web/entry/user-note.php diff -u php-master-web/entry/user-note.php:1.62 php-master-web/entry/user-note.php:1.63 --- php-master-web/entry/user-note.php:1.62 Mon Feb 5 03:13:13 2007 +++ php-master-web/entry/user-note.php Sat Feb 10 03:39:27 2007 @@ -65,12 +65,19 @@ } // check if the note contains some prohibited words +$note_lc = strtolower($note); foreach($worlds_backlist as $bad_word) { - if (strpos($note, $bad_word) !== false) { + if (strpos($note_lc, $bad_word) !== false) { die('[SPAM WORD]'); } } +// run a few more spam checks +if (is_spam($note_lc)) { + die ('[SPAM WORD]'); +} +unset($note_lc); + // check with spamassassin if the note is spam or not /* $spam = shell_exec('echo ' . escapeshellarg($note) . " | $spamassassin -L -e 8"); @@ -211,6 +218,16 @@ return false; } +function is_spam ($text) { + if (preg_match('/\[(url|link)=[^]]+\]/', $text)) { + return true; + } + if (substr_count($text, 'http://') > 4) { + return true; + } + return false; +} + //var_dump(is_spammer('127.0.0.1')); // false //var_dump(is_spammer('127.0.0.2')); // true

« previous php.mirrors (#34191) next »