View Single Post
07-30-2010, 01:27 PM   #1
Jeff
Administrator
 
Jeff's Avatar
 
Join Date: Jul 2010
Posts: 402
Rep Power: 10
Jeff is getting browny points
Checking IP's against spammer database

There is a good free RBL that checks users against a database of known forum spammers. You can check a users IP against it before allowing them to do anything on your site. Here is some example PHP code:

Code:
function blacklisted($ip) 
{
    $dnsbl_check=array("dnsbl.tornevall.org");

    if($ip){
        $rip=implode('.',array_reverse(explode(".",$ip)));
        foreach($dnsbl_check as $val){
            if(checkdnsrr($rip.'.'.$val.'.','A'))
                return $rip.'.'.$val;
        }
    }

    return false;
}
Basically just pass the IP to this function and if it comes back as true, then the IP is listed.

Enjoy!
Jeff is offline   Reply With Quote