小修改阻止Movable Type的垃圾评论

这段时间针对MT系统的垃圾评论多的让人受不了,看了官方的应对措施,不管是MT-Blacklist,还是MT-DBSL,以及Scode,由于我所用的虚拟主机的Perl环境问题,都不能正常运行。怎么办?难道就眼睁睁的看着自己的Blog被评论机器人大肆灌水?不仅占用空间,还污染环境?这是万万不能容忍的!而经过摸索,终于找到了一个暂时的可行的解决办法。

用文本编辑器打开“MT所在路径/lib/MT/App”下的Comments.pm文件,搜索:

if (!$blog->allow_anon_comments &&
        (!$comment->author || !$comment->email)) {
        return $app->handle_error($app->translate(
                           "Name and email address are required."));

在其后面加上

if ( $comment->author eq "online poker" || $comment->author eq "viagra" || $comment->author eq "phentermine" || $comment->author eq "valium" || $comment->author eq "debt consolidation" || $comment->author eq "poker" || $comment->author eq "phentermine" || $comment->author eq "online poker" || $comment->author eq "no limit texas hold em" || $comment->author eq "poker rooms" || $comment->author eq "internet poker" || $comment->author eq "party poker" || $comment->author eq "texas hold em poker" || $comment->author eq "poker tournament" || $comment->author eq "no limit texas hold em" || $comment->author eq "poker party" || $comment->author eq "cialis"){
            return $app->handle_error($app->translate(
                           "Your name is spammer."));

其中$comment->author eq "online poker"中的online poker可以替换为其它发送垃圾评论的用户名。

这样做后效果还是比较明显的,但愿能够给那些和我一样使用没有相应模块的虚拟主机的朋友们以帮助!