Tetra-WebBBS Support Forum
Re: block empty messages?
In Response To: Re: block empty messages? ()
Seen and testresponse made. Delete both
What you see as an empty message actually isn't empty. Your editor adds some code to the field, thus it isn't empty.
Here is the HTML source of the section when viewed:
<div class="msg_text"><br /> <p> </p></div>
So we can't just look for an "empty" input on that form but would have to filter on that sniplet of code - IF that's the code coming in.
Throwing an meaningfull error will help your registered users but bots will adopt quickly.
Anyway, to get you startet:
Make a copy of your entry script.
In section (3) of the copy add:
if ( ($ENV{'QUERY_STRING'} =~ /$QueryMode{'post'}/)
|| ($ENV{'REQUEST_URI'} =~ /$QueryMode{'post'}/)
) {
my $teststring = $tbb->{'post'}->{'body'};
$teststring =~ s/<.+?>//gi;
$teststring =~ s/ //gi;
if ($teststring !~ /[a-z0-9]/){
$tbb->tbb_mappings();
$tbb->{'conf'}->{'main'}->{'BBSquery'}
= $tbb->{'conf'}->{'main'}->{'BBSquery_short'}
= $tbb->{'conf'}->{'main'}->{'QS0'};
$text{'9522'} = 'headline';
$text{'9523'} = 'errortext';
$tbb->send_error_plain( '9522', '9523' );
exit;
}
}
NOTE:
untestet code, I may have typos somewhere.
Rainer

![[+]](/i/toc_collapsed.gif)
![[-]](/i/toc_expanded.gif)
WebScripts










