// ********************************************************************************* // BEGIN CHECK BOTSCOUT // ********************************************************************************* // // Check the e-mail address against BotScout // if($mail !='' && $sBSAPI !=''){ $bFoundMatch=false; $fspamcheck = getURL('http://botscout.com/test/?key='.$sBSAPI.'&mail='.$mail); if (strpos($fspamcheck, '! ') !==False) { $bFoundMatch = false; echo 'Error: '.$fspamcheck; }else{ if (strpos($fspamcheck, 'Y|') !==False) { $bFoundMatch = true; } } if($bFoundMatch==true){ $bsspambot = true; } // End if($bsxml->appears == 'Y') (Email) } // End If // // Now check the IP // if($ip !='' && $sBSAPI !=''){ $bFoundMatch=false; $fspamcheck = getURL('http://botscout.com/test/?key='.$sBSAPI.'&ip='.$ip); if (strpos($fspamcheck, '! ') !==False) { $bFoundMatch = false; echo 'Error: '.$fspamcheck; }else{ if (strpos($fspamcheck, 'Y|') !==False) { $bFoundMatch = true; } } if($bFoundMatch==true){ $bsspambot = true; } // End if($bsxml->appears == 'Y') (IP) } // End If // // Lets check the username // if($name !='' && $sBSAPI !=''){ $bFoundMatch=false; $fspamcheck = getURL('http://botscout.com/test/?key='.$sBSAPI.'&name='.$name); if (strpos($fspamcheck, '! ') !==False) { $bFoundMatch = false; echo 'Error: '.$fspamcheck; }else{ if (strpos($fspamcheck, 'Y|') !==False) { $bFoundMatch = true; } } if($bFoundMatch==true){ $bsspambot = true; } // End if($bsxml->appears == 'Y') (username) } // End If if($bsspambot == true){ $spambot = true; // Required seperately now that dumping to a text file is optional echo 'BotScout '; } // ********************************************************************************* // END CHECK BOTSCOUT // *********************************************************************************getURL is a function I wrote that allows determination of whether to use cURL or file_get_contents;Code:function getURL($sURL){ if(function_exists('file_get_contents')){ // Use file_get_contents $sURLTemp = file_get_contents($sURL); }else{ // Use cURL (if available) $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $sURL); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $sURLTemp = curl_exec($curl); curl_close($curl); } return $sURLTemp;}
// *********************************************************************************// BEGIN CHECK BOTSCOUT// *********************************************************************************//// Check the username etc against BotScout. Done using a single query for efficiency// as we don't need multiple queries for the plain version.//// If any of the values are missing, BotScout will ignore them (better for us as it// prevents us having to deal with them, which thus prevents spammers potentially// abusing it)//public function CheckBotScout($sBSMail, $sBSIP, $sBSName){ $sBSAPI = ''; // YOUR API KEY HERE $bFoundMatch=false; // What do you want to base your match on? // // 1,2 = Match if username AND IP are listed // 1,3 = Match if username and Email are listed // 2,3 = Match if IP and Email are listed // // You can use more than one at a time if required, by seperating them with |, for example; // // $sBaseMatch = '1,2|2,3'; // $sBaseMatch = ''; $sBSURL = 'http://botscout.com/test/?multi&key='.$sBSAPI.'&mail='.$sBSMail.'&ip='.$sBSIP.'&name='.$sBSName; $fspamcheck = getURL($sBSURL); // BotScout error codes begin with an apostrophe, so we'll check for those first if (strpos($fspamcheck, '! ') !==False) { $bFoundMatch = false; // If an error is returned, we can't determine if it was a hit or miss, so default to miss echo 'Error: '.$fspamcheck; }else{ // $sSpamData[3] = IP // $sSpamData[5] = Email // $sSpamData[7] = Username if($_GET['debug']=='1'){echo 'SENT: '.$sBSURL.'RECEIVED: '.$fspamcheck.'<br>';} $sSpamData = explode('|',$fspamcheck); if($sSpamData[0] == 'Y'){ switch($BaseMatch){ case "1,2": // Match username and IP if($sSpamData[7] > 0 && $sSpamData[3] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,3": // Match username and E-mail if($sSpamData[7] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "2,3": // Match IP and E-mail if($sSpamData[3] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,2|1,3": // Match username and IP OR username + E-mail if($sSpamData[7] > 0 && $sSpamData[3] > 0 || $sSpamData[7] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,2|1,3|2,3": // Match username and IP OR username + E-mail OR IP + E-mail if($sSpamData[7] > 0 && $sSpamData[3] > 0 || $sSpamData[7] > 0 && $sSpamData[5] > 0 || $sSpamData[3] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,2|2,3": // Match username and IP OR IP + E-mail if($sSpamData[7] > 0 && $sSpamData[3] > 0 || $sSpamData[3] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,3|2,3": // Match username and Email OR IP + E-mail if($sSpamData[7] > 0 && $sSpamData[5] > 0 || $sSpamData[3] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; case "1,2,3": // Match Username, IP and E-mail if($sSpamData[7] > 0 && $sSpamData[3] > 0 && $sSpamData[5] > 0){$bFoundMatch = true;}else{$bFoundMatch = false;} break; default: $bFoundMatch = true; break; } // End Switch }else{ $bFoundMatch = false; } // End if($sSpamData[0] ... } // End if (strpos($fspamcheck, '! ') !==False) if($bFoundMatch==true){ return 'TRUE'; }else{ return 'FALSE'; } // End if($bFoundMatch==true)}// *********************************************************************************// END CHECK BOTSCOUT// *********************************************************************************