Dealing With Forum & Mailing List Spam
Dealing With Forum & Mailing List Spam
Written by Ian Elliot   
Friday, 04 January 2013
Article Index
Dealing With Forum & Mailing List Spam
Stop Forum Spam API in PHP
Complete program

Complete program

Putting all this together gives:

 try {
  $dbh = new PDO('mysql:host=localhost;
  $rows=$dbh->query('SELECT email from MyUsers
           ORDER BY id DESC  LIMIT '.$number);
  foreach($rows as $row) {
    $result= checkSpam($email);
    echo $email;
    if($result) echo "X";
    echo "<BR/>";
        $dbh->query('DELETE FROM MyUsers
          WHERE email ="'.$row[email].'"');
    $dbh = null;
    echo $count;
 } catch (PDOException $e) {
    print "Error!: ".

function myFlush() {
   echo(str_repeat(' ', 256));
   if (@ob_get_contents()) {

function checkSpam($email){
 $baseURL =
 $url = $baseURL.'?'.
         http_build_query($query, '', '&');
 $json= file_get_contents( $url );
 $result = json_decode($json);
  return $spammer;

You can customize the program to be cleverer if you want to and this is certainly just a starting point.

In use the program deletes aproximately 50% of new signups but there are roughly 25% of the remainder that look a lot like spam addresses. The task of keeping spam under control is difficult.

If you would like the code for this article register with I Programmer and visit the codebin.



More Information


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.


blog comments powered by Disqus


Last Updated ( Tuesday, 08 January 2013 )

RSS feed of all content
I Programmer - full contents
Copyright © 2015 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.