View Spambots
<?php
function checkSpambots($mail,$ip,$name){
$spambot = false;
//put the main domains in the array
$main_domains = array('mail.ru','bigmir.net');
//check the e-mail adress
$xml_string = file_get_contents('http://www.stopforumspam.com/api?email='.$mail);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes'){
$spambot = true;
}elseif($spambot != true){
//e-mail not found in the database, now check the ip
$xml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ip);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes'){
$spambot = true;
}
}
//check the main domains if there is still no spammer found, you can add more if you want in the $main_domains array
if($spambot != true){
for($i = 0; $i < count($main_domains); $i++){
if(ereg($main_domains[$i],$mail) == 1){
$spambot = true;
}
}
}
// create an .txt file with the info of the spambot, if this one already exists, increase its amount of try's
if($spambot == true){
if(file_exists('spambots/'.$mail.'.txt')){
$spambot_old_info = file_get_contents('spambots/'.$mail.'.txt');
$spambot_old_info = explode(',',$spambot_old_info);
$spambot_old_info[2] = $spambot_old_info[2]+1;
$spambot_old_info = implode(',',$spambot_old_info);
file_put_contents('spambots/'.$mail.'.txt',$spambot_old_info);
}else{
$spambot_info = $ip.','.$name.',1';
file_put_contents('spambots/'.$mail.'.txt',$spambot_info);
}
}
return $spambot;
}
if($_POST['submit']){
$spambot = checkSpambots($_POST['email'],$_SERVER['REMOTE_ADDR'],$_POST['name']);
if($spambot == true){
echo "You are a spambot!"; //We found a spambot! call 911!!!
}else{
echo "Nope, not a spambot."; //he can register as usual
}
}
?>
<form method='post'>
Name: <input type='text' name='name'><br>
E-mail: <input type='text' name='email'><br>
<input type='submit' name='submit' value='check'>
</form>