PHP function for checking BotScout, generously provided by MysteryFCMThis code uses the "MULTI" query, which is the preferred (recommended)
way to run queries against the BotScout database.// *********************************************************************************
// 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
// *********************************************************************************