1 (edited by JanMichaels 2011-10-21 01:48)

Topic: stop forum spammer signups

Hopefully I'm posting this in the right place and that it helps someone!

This addition to your signup page uses the stoparticlespam site for blocking previously reported (387K) spammer signups. It sends the signups ip, email and username for checking and if any are found, returns a "Yes" so you can send them to a custom denied page or wherever you wish.

Open register.php and find this code:

if (empty($errors))
    {
        $username = forum_trim($_POST['req_username']);
        $email1 = strtolower(forum_trim($_POST['req_email1']));

Right under the $email1 line, copy/paste this code:

//////////////////////////////////////////////////////////////////////////////////////////////
// stoparticlespam code start

        $ip_check = "";
        $ip_check = $_SERVER['REMOTE_ADDR'];
        
    $SAS_url = "";
    $SAS_url = "http://www.stoparticlespam.info/api.php";
   
// CHECK STOPARTICLESPAM FOR SPAMMER  
 
  $wrap = ini_get('allow_url_fopen');
     if(function_exists('file_get_contents') && $wrap == '1')
      {
       $Contents = @file_get_contents($SAS_url.'?email='.urlencode($email1).'&ip='.urlencode($ip_check).'&username='.urlencode($username));
        if(!empty($Contents) && $Contents == 'Yes')
         {
   // Your custom message
       header('HTTP/1.1 400 Bad Request');
        die("<br><br><h3 style='color:red;text-align:center;'>Sorry, but you have been listed for spamming at stoparticlespam.</h3><p style='text-align:center;'>If you feel this is an error, please contact us!</p>");
       }
     }else{
    // file_get_contents won't work so we'll try cURL instead!
    if(function_exists('curl_init'))
     {
      $ch = curl_init();
      $timeout = 6; // set to zero for no timeout
      curl_setopt ($ch, CURLOPT_URL, $SAS_url);
      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, '?email='.urlencode($email1).'&ip='.urlencode($ip_check).'&username='.urlencode($username));
      curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
      $Contents = curl_exec($ch);
      curl_close($ch); 
      if(!empty($Contents) && $Contents == 'Yes')
      {
   ///// A 'Yes' was returned by stoparticlespam, which means one of the submitted variables was found in their database!
  
// Your custom message
       header('HTTP/1.1 400 Bad Request');
        die("<br><br><h3 style='color:red;text-align:center;'>Sorry, but you have been listed for spamming at stoparticlespam.</h3><p style='text-align:center;'>If you feel this is an error, please contact us!</p>");
    }
   }
  }

// end stoprarticlespam code

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////        

The code above will try using file_get_contents and if it's not enabled, try checking with cURL instead.  The

// Your custom message
       header('HTTP/1.1 400 Bad Request');
        die("<br><br><h3 style='color:red;text-align:center;'>Sorry, but you have been listed for spamming at stoparticlespam.</h3><p style='text-align:center;'>If you feel this is an error, please contact us!</p>");

part is what sends the denied person to wherever you wish them to go or see if denied.  You can also change that part to send them to a custom page if you wish.


best,

Jan

Re: stop forum spammer signups

Thanks,
but it would be better if you looked at the sfs antispam and stopforumspam.com extensions and integrated it that way
PunBB 1.3 is about NOT manually changing source code but doing it through extensions

Also, I don't believe the site you're recommending stoparticlespam has an especially good standing in the community - or how would you differentiate yourself from stopforumspam or botscout ?

3 (edited by JanMichaels 2011-10-21 07:36)

Re: stop forum spammer signups

Alright, I will look at that thanks!   I wrote one for another forum, and I guess I'll write one for punbb as well. I'm not sure why you'd think stoparticlespam has any bad standing in the community.  It's only been up for about a month now, and I've been very focused on keeping on top of questionable spam submissions and quick to remove disputed submissions.

how would you differentiate yourself from stopforumspam or botscout ?

Tough question.. it's like asking how you'd differentiate one police department from another as they all do the same thing.  Or, how would one differentiate one forum software from another? I guess by being new, I'm willing to work harder to help than others that may be resting on their laurels  big_smile 

Since writing an article publishing script, my reason for creating stoparticlespam was for stopping spam signups & articles on my client's sites by writing in the signup blocking code to my scripts as an added feature (my clients requested it as they weren't too happy with the constant downtime of another spam service).  I later discovered the same people that spam forums also spam article sites, so instead of just article site spam blocking, I'm doing both article sites and forums (and blogs).

Anyway, sorry for the long explanation, and I'll go figure out this forum's extension scheme and submit that way.. I'll try to also add something to make mine a little different than the others.   smile

best,

Jan

Re: stop forum spammer signups

Your efforts are appreciated !

Just wanted to hear a bit more. Sounds interesting and in the interest of spam fighting.

PS: You might consider adding your rules , integrating them into the SFS Antispam extension by Justice - as a double check would be even better for the community (IMO... just a thought)

Re: stop forum spammer signups

Thank you KeyDog, that sounds like a good idea if it would  be more helpful and Justice doesn't mind.  I'll check that out also...

Have a good one and thanks for your help,

Jan