phpCF - Introduction -------------------- How does it work? ----------------- phpCF scans a text (and optionally an email address along with the text) and assigns points for each suspicious thing found in the text. Suspicious things can be lots of things, for example a lot of URLs - but a normal user might post a lot of urls as well... Luckilly phpCF reacts to more than just URLs. Another suspicious thing is a lot of HTML - especially if HTML is not allowed on the site in question. So phpCF assigns spam points for that as well. As I write this (for the initial phpCF release) phpCF is still not very mature, as it hasn't had the chance to encounter the vast amount of different spamming methods out there - but it'll get way more sophisticated as I get the chance to enhance it. Applications - Where can you use it? ------------------------------------ Well, I've written phpCF solely for keeping my own blog clean from spam, but I can easilly imagine other applications, such as in wikies, in forums and as plugin for mature blogging applications such as WordPress or for some of the many CMS'es out there. The implementation is extremely easy, so even if you've only been coding PHP for a couple of weeks you'll be able to use it effectively. Implementation -------------- As stated above, phpCF is extremely easy to use. (See the README for installation instructions.) All you have to do is to include the file 'phpCF/class.CF.php' in the script you wish to call phpCF from, like this: include_once 'phpCF/class.CF.php'; and then do the following: $cf = new CF($text); And now the contents of $text has been scanned. If you want to examine an email address along with the text, it's just as easy. $cf = new CF($text, $email); Even checking if the IP is blacklisted is easy: $cf = new CF($text, $email, $_SERVER['REMOTE_ADDR']); And should you like to check the IP but not the email. $cf = new CF($text, "", $_SERVER['REMOTE_ADDR']); Finally, check if phpCF thinks that $text is spam... if ($cf->isSpam()) { // It's spam, ditch it! } else { // It's clean, hooray! } And that's all there is to it! If you want more control (or knowledge) of phpCF, then take a look at phpCF/docs/CF.txt - it describes the inner workings of phpCF and can perhaps give you some good ideas of how to get even more out of phpCF. More? ----- If you have any questions that aren't answered here, in the README or in the other docs, please send me an email and I'll get back to you as fast as possible. Anders K. Madsen http://lillesvin.net