Scripts
Spambot Detector V2
Deze detector gebruikt www.stopforumspam.com zijn API, het werkt vrij simpel, je geeft de mail en het ip mee van de registreerder en de functie chekt of je registreerder een spambot is, true als dat zo is, false als het niet zo is. Ik hoop dat jullie er iets aan hebben, je kunt ook meerdere sites chekken, ik vond deze handig en er worden hier ook dagelijks massaal spambots toegevoegd. Ik heb een functie opgezocht om de content van de API op te halen, dit kan ook met een standaard functie, maar deze kan uitstaan. Let op dat je een map hebt die spambots heeft en deze op 0777 staat anders werkt het niet.
spambot-detector-v2
[code]
<?php
#########
##testspambot.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 "Je bent een spambot!";
}else{
echo "Je kunt gewoon doorgaan met registreren, je bent geen spambot";
}
}
?>
<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>
<a href='spambots_uitlezen.php'>View Spambots</a>
[/code]
en het uitlezen van de bestanden:
[code]
<?php
#######
##spambots_uitlezen.php
#######
$spambots = scandir('spambots');
echo "<table border=1 style='border: 1px dotted #2a2a2a; padding: 2px; border-collapse: collapse;'>";
echo "<tr> <td><b>Name</b></td><td><b>E-mail Adress</b></td><td><b>Ip-Adress</b></td><td><b>Amount of trys</b></td></tr>";
foreach($spambots as $value){
if($value != '.' && $value != '..'){
$spambot_info = file_get_contents('spambots/'.$value);
$spambot_array = explode(',',$spambot_info);
$mail = substr($value, 0, -4);
echo "<tr><td>".$spambot_array[1]."</td><td>".$mail."</td><td>".$spambot_array[0]."</td><td>".$spambot_array[2]."</td></tr>";
}
}
echo "</table>";
?>
<a href='testspambot.php'>The Spambot Detector</a>
[/code]
Reacties
0