Sblam!

Blocks blog spam

Sblam! — installation

Find on your website a script which is reponsible for receiving form data. Find a fragment within that script which checks for validity of input data. The point is to check post before adding it to the database, but not when it has been rejected because of missing fields or when only preview is being displayed.

Include sblamtest.php in your script:

include_once "sblamtest.php";

And tell it to check the post:

$result = sblamtestpost();

Result is a number:

  • 0 signals an error. Post has not been checked.
  • 2 signals certain spam, which can be deleted without hesitation.
  • 1 signals probable spam (which you might want to queue for moderation).
  • -1 signals probable non-spam (as above)
  • -2 signals certain non-spam, which can be safely published.

Do not try to send spams for testing! Read testing section on this page first.

The simplest implementation is:

if ($result > 0) {
  die('<h1>Sorry - your comment has been classified as spam!</h1>
  <p><a href="'.sblamreporturl().'">Report an error</a>.</p>');
}

You can assume that when anyone reads your spam message, the filter was mistaken. sblamreporturl() funtion returns unique URL, where user can report false positive.

Unusual field names?

If your form uses unusual field names (usual are text, author, email, url), you should specify them. NB: pass only names of the fields, not their content (script will read content from $_POST automatically).

Order of the fields is: text, author's name, e-mail address given by the author and link to his homepage. Fields are optional. Insert NULL if a certain field is not present on your form.

<input type="text" name="thenick">
$rezultat = sblamtestpost(array('commentos', 'thenick', 'eemail', 'wideweblink'));

Please note that field names are given in array(), and not as separate function arguments.

Additional JavaScript

You're not required to place this JavaScript on your page, but if you do, filtering will be more accurate.

Location of the script in code is very important. Script must be placed directly after closing tag of form (</form>), which you want to have filtered:

<form action="..." method="post">...</form>
<script src="/sblam.js.php" type="text/javascript"></script>

Correct path /sblam.js.php if your site does not have it's own domain or you're going to place Sblam! files somewhere else than root of your site.

Testing

Do not send spams for testing! Filter may take you for spammer and block your IP!

To test whether blocking works, send "to jest test spamu". This is a special text that causes Sblam! to return 1 without blacklisting its sender.

If text "to jest test spamu" does not cause message to be rejected as spam, probably Sblam! cannot figure out names of fields in your form. See unusial fields above.

To check accepted posts, just send some usual text or copy a previous non-spam post.

Contact author, who's not a PHP basics tutor.

Download script it's free — license

Requirements

  • PHP 4.2+ or PHP 5.
  • Sockets (standard) extension enabled.
  • Basic knowledge of PHP programming.
(recommended screen resolution 1980×1200 ;)
2007.03. Sblam! Author: porneL, Webmistress: Falka