Location: PHPKode > scripts > Spam Filter > spam-filter/guestbook.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<TITLE>Guestbook</TITLE>
</HEAD>

<BODY>

<?
//---------------------------------------------------------------------------
// *** Add posts with the 'add' _get parameter
//---------------------------------------------------------------------------
include('spamfilter.php');
$sf = new SpamFilter();
$filename = 'guestbook.txt';
fclose(fopen($filename,'a'));
if ($_GET['add']) {
	$f = fopen($filename,'a');
	fwrite($f,$_GET['add']."[EOF]\r\n\r\n");
	fclose($f);
}
$contents = implode('',file($filename));
$posts = explode("[EOF]\r\n\r\n",$contents);
if ($_GET['spam'] != '') $sf->movefrom($posts[$_GET['spam']],NORMAL);
if ($_GET['normal'] != '') $sf->movefrom($posts[$_GET['normal']],SPAM);
foreach ($posts as $id => $post) {
	if ($post) {
		echo nl2br($post);
		if ($sf->filter($post,0.6)) {
			echo '<br />THIS MESSAGE WAS MARKED AS SPAM WITH A SCORE OF '.$sf->textscore($post).' ';
			echo "(<a href='guestbook.php?normal=$id'>Mark as Normal</a>)<br />";
		}
		else echo "<br /><a href='guestbook.php?spam=$id'>Mark as Spam</a> (Score: ".$sf->textscore($post).")<br />";
		echo "<br />------------------<br /><br />";
	}
}
?>

</BODY>
</HTML>
Return current item: Spam Filter