• [MOD] Stop spam bots registration - bad email check 5 0 5 1
Currently:  

Author Topic: [MOD] Stop spam bots registration - bad email check  (Read 24193 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
[MOD] Stop spam bots registration - bad email check
« on: October 26, 2009, 12:37:18 PM »
I found interesting website that contains database from different forum spam bots: http://www.stopforumspam.com/

I've integrated their API in 4images gallery to prevent bots to register (even thought I'm using capcha system, bots somehow managed to register).

This mod is taken from their forum so all the credit goes to author:
http://www.stopforumspam.com/forum/t598-Basic-file-read

1. Open includes/functions.php and before:
Code: [Select]
?>
add
Code: [Select]
function checkspammers($input,$inputtype='email'){
    //Load the file, and implode the array.
    $xml = implode('',file("http://www.stopforumspam.com/api?".$inputtype."=".$input));

//Start new xml parser.
    $p = xml_parser_create();
   
    //Get the xml into an array
    xml_parse_into_struct($p, $xml, $vals, $index);
   
    //Free some memory by clearing the xml parser
    xml_parser_free($p);
   
    //We don't need $index or the $xml any more
    unset($index,$xml);
   
   
    //Prepare the return array
    $return = array();
   
    //Now we are going to make the aray useable
    foreach($vals as $array){
        //If it's the opening array we can do it slightly differnetly
        if($array['type'] == 'open'){
            //Just get weather it was sucess or not.
            $return[$array['tag']] = $array['attributes']['SUCCESS'];
        }elseif($array['type'] == 'complete'){
            //Else just get the value
            $return[$array['tag']] = $array['value'];
        }
    }
   
    //Save a bit mroe memory by clearing the vals array
    unset($vals);
   
    //Now make time into a unix timestamp
    if($return['LASTSEEN']){
        //Sepparate the timestamp into the time and the date
        $time = explode(' ',$return['LASTSEEN']);
        //Sepparate the date
        $date = explode("-",$time[0]);
        //Sepparate the time
        $time = explode("-",$time[0]);
       
        //Now make the time, note we times by 1 to remove leading zeros, if we don't then php cansometimes use teh octal system instead of decimal.
        $return['UNIXLASTSEEN'] = gmmktime($time[0]*1,$time[1]*1,$time[2]*1,$date[1]*1,$date[2]*1,$date[0]*1);
    }
   
    //RESPONCE would be better as booleen, not a string
    if($return['RESPONCE'] == 'true'){ $return['RESPONCE'] = true; }else{ $return['RESPONCE'] = false; }
   
    //Now return our array.
    return $return;
}

//Example function to check in ip
function isaspammer($ip){
    //Get the xml results as an array from teh function above
    $result = checkspammers($ip);
    //Is he reported?
    if($result['FREQUENCY'] > 0 && (time() - $result['UNIXLASTSEEN']) < (3600 * 24 * 365)){
        //He is a spammer
        return true;
    }else{
        //He is not reported as a spammer
        return false;
    }
}

2. Open register.php

before:
Code: [Select]
if ($user_password == "") {
add
Code: [Select]
    if (isaspammer($user_email)) {
      $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format']; // or add anything else, bots doesn't understand nothing :)
      $error = 1;
    }

Simple as that  :wink:

PS: it's also possible to check their IP, but email check is working for me (now)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Stop spam bots registration - bad email check
« Reply #1 on: October 26, 2009, 01:13:50 PM »
hmm....are you sure it's working? you are submitting email, instead of IP...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Stop spam bots registration - bad email check
« Reply #2 on: October 26, 2009, 01:36:56 PM »
It's working, check this again:
Code: [Select]
function checkspammers($input,$inputtype='email'){
    //Load the file, and implode the array.
    $xml = implode('',file("http://www.stopforumspam.com/api?".$inputtype."=".$input));

inputtype is email, so api will check email insted of IP.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Stop spam bots registration - bad email check
« Reply #3 on: October 26, 2009, 02:07:51 PM »
Yes, you are right.
My bad, sorry :oops:

to check by email and IP:
    if (isaspammer($user_email) || isaspammer($site_sess->user_ip"ip")) {
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

rinaldos

  • Guest
Re: [MOD] Stop spam bots registration - bad email check
« Reply #4 on: October 26, 2009, 02:34:19 PM »
I've tested this one. It works like a charme :-) This secures the Website a little bit more :-)

Thanks for Posting...
Gruß
ingo

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Stop spam bots registration - bad email check
« Reply #5 on: October 28, 2009, 11:05:08 AM »
I must say that even I am little surprised how effective is this modification, couse since I've install it none of bad bots have registered in my gallery  :mrgreen:

Rembrandt

  • Guest
Re: [MOD] Stop spam bots registration - bad email check
« Reply #6 on: October 28, 2009, 08:22:13 PM »
Hi!

This modification will only work if the server config [function.file] enabled.
at Freehost provider this is not the case.
otherwise an error occurs:  " Warning: file() [function.file]: URL file-access is disabled in the server configuration."

mfg Andi

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [MOD] Stop spam bots registration - bad email check
« Reply #7 on: October 29, 2009, 02:26:06 PM »
Worls perfect for me:

1. Öffne / Open includes/functions.php
Suche / Search
Code: [Select]
?>
Davor einfügen: Add abbove
Code: [Select]
function checkspammers($input,$inputtype='email'){
    //Load the file, and implode the array.
    $xml = implode('',file("http://www.stopforumspam.com/api?".$inputtype."=".$input));

//Start new xml parser.
    $p = xml_parser_create();
   
    //Get the xml into an array
    xml_parse_into_struct($p, $xml, $vals, $index);
   
    //Free some memory by clearing the xml parser
    xml_parser_free($p);
   
    //We don't need $index or the $xml any more
    unset($index,$xml);
   
   
    //Prepare the return array
    $return = array();
   
    //Now we are going to make the aray useable
    foreach($vals as $array){
        //If it's the opening array we can do it slightly differnetly
        if($array['type'] == 'open'){
            //Just get weather it was sucess or not.
            $return[$array['tag']] = $array['attributes']['SUCCESS'];
        }elseif($array['type'] == 'complete'){
            //Else just get the value
            $return[$array['tag']] = $array['value'];
        }
    }
   
    //Save a bit mroe memory by clearing the vals array
    unset($vals);
   
    //Now make time into a unix timestamp
    if($return['LASTSEEN']){
        //Sepparate the timestamp into the time and the date
        $time = explode(' ',$return['LASTSEEN']);
        //Sepparate the date
        $date = explode("-",$time[0]);
        //Sepparate the time
        $time = explode("-",$time[0]);
       
        //Now make the time, note we times by 1 to remove leading zeros, if we don't then php cansometimes use teh octal system instead of decimal.
        $return['UNIXLASTSEEN'] = gmmktime($time[0]*1,$time[1]*1,$time[2]*1,$date[1]*1,$date[2]*1,$date[0]*1);
    }
   
    //RESPONCE would be better as booleen, not a string
    if($return['RESPONCE'] == 'true'){ $return['RESPONCE'] = true; }else{ $return['RESPONCE'] = false; }
   
    //Now return our array.
    return $return;
}

//Example function to check in ip
function isaspammer($ip){
    //Get the xml results as an array from teh function above
    $result = checkspammers($ip);
    //Is he reported?
    if($result['FREQUENCY'] > 0 && (time() - $result['UNIXLASTSEEN']) < (3600 * 24 * 365)){
        //He is a spammer
        return true;
    }else{
        //He is not reported as a spammer
        return false;
    }
}

2. Öffne / Open register.php

Suche / Search:
Code: [Select]
if ($user_password == "") {
Davor einfügen / Add above
Code: [Select]
    if (isaspammer($user_email) || isaspammer($site_sess->user_ip, "ip")) {
      $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_email_format']; // or add anything else, bots doesn't understand nothing :)
      $error = 1;
    }

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] Stop spam bots registration - bad email check
« Reply #8 on: November 01, 2009, 03:20:58 AM »
http://www.nuwaragedara.com/Gallery/details.php?image_id=54&sessionid=42abd0066529b2ddb6de6b118c9f4f2e#
Hey have a luk at this//..

can i stop this by installing this mode ?

tnx in advance !
I'm Back :)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Stop spam bots registration - bad email check
« Reply #9 on: November 01, 2009, 03:27:57 AM »
I doubt this mod will help you, as your comments don't require users submit valid email addresses...

On other thought, you can use this mod to check IP addresses...you should give it a try.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] Stop spam bots registration - bad email check
« Reply #10 on: November 02, 2009, 04:31:31 AM »
this works perfect...  :D u know what .. a friend of me asked from me "HEY BRP..ITS IMPOSSIBLE TO PASS A BOT TO UR 4IMAGE...HOW DID U DO IT" ?

im sry to say..he was the spammer in ma site  :mrgreen:

tnx to this mode..im saved now !
I'm Back :)

Offline comicart

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: [MOD] Stop spam bots registration - bad email check
« Reply #11 on: August 28, 2010, 10:10:23 PM »
Is this STILL working for everybody?
For some reason it's just not working for me. I'm testing by registering with a fictional "spam type" address. spammer@adlkjasdlkfjasdflkjasdf.com (or whatever).
Those registrations go through.

PHP version   5.2.8
4images 1.7.8 <--- just upgraded

Are there any alternatives to this that do the same thing?

Terry
« Last Edit: August 29, 2010, 06:47:02 AM by comicart »

Rembrandt

  • Guest
Re: [MOD] Stop spam bots registration - bad email check
« Reply #12 on: August 29, 2010, 06:43:33 AM »
I'm testing by registering with a fictional "spam type" address. spammer@adlkjasdlkfjasdflkjasdf.com (or whatever).
Those registrations go through.
this test-email address is not in the database from stopforumspam.
here can you test the email address.

mfg Andi
« Last Edit: August 29, 2010, 07:23:14 AM by V@no »