«

Fighting Comment Spam Without MT-Blacklist

  <p>
    # Copyright 2001-2004 Six Apart. This code cannot be redistributed without<br /> # permission from www.movabletype.org.<br /> #<br /> # $Id: mt-comments.cgi,v 1.35 2004/05/17 19:51:25 ezra Exp $<br /> use strict;
  </p>
  
  <p>
    use CGI;<br /> my $cgi = new CGI;<br /> my $commentText = $cgi->param(&#8216;text&#8217;);
  </p>
  
  <p>
    if ($commentText =~ m/http:/i)<br /> {<br /> print &#8220;Content-Type: text/html;\n&#8221;;<br /> print &#8220;Status: 404 Not Found\n&#8221;;<br /> print &#8220;\n&#8221;;<br /> }<br /> else<br /> {<br /> my($MT_DIR);<br /> BEGIN {<br /> if ($0 =~ m!(.*[/\\])!) {<br /> $MT_DIR = $1;<br /> } else {<br /> $MT_DIR = &#8216;./&#8217;;<br /> }<br /> unshift @INC, $MT_DIR . &#8216;lib&#8217;;<br /> unshift @INC, $MT_DIR . &#8216;extlib&#8217;;<br /> }
  </p>
  
  <p>
    eval {<br /> require MT::App::Comments;<br /> my $app = MT::App::Comments->new( Config => $MT_DIR . &#8216;mt.cfg&#8217;,<br /> Directory => $MT_DIR )<br /> or die MT::App::Comments->errstr;<br /> local $SIG{__WARN__} = sub { $app->trace($_[0]) };<br /> $app->run;<br /> };<br /> if ($@) {<br /> print &#8220;Content-Type: text/html\n\n&#8221;;<br /> print &#8220;An error occurred: $@&#8221;;<br /> }<br /> }
  </p></blockquote></div>