After: $this->document->setTitle($this->language->get('heading_title'));
add
Code: Select all
$bogus = "0";
$string = "0";
if (!empty($this->request->post['email'])) {
$string = $this->request->post['email'];
$badWords = array("googlemail", "no-reply", "noreply");
$matchFound = preg_match_all("/(" . implode("|",$badWords) . ")/i", $string, $matches);
//Get host name from email and check if it is valid
$email_host = array_slice(explode("@", $string), -1)[0];
// Check if valid IP (v4 or v6). If it is we can't do a DNS lookup
if (!filter_var($email_host,FILTER_VALIDATE_IP, [
'flags' => FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE,
])) {
//Add a dot to the end of the host name to make a fully qualified domain name
// and get last array element because an escaped @ is allowed in the local part (RFC 5322)
// Then convert to ascii
$email_host = idn_to_ascii($email_host.'.');
//Check for MX pointers in DNS (if there are no MX pointers the domain cannot receive emails)
if ( (!checkdnsrr($email_host, "MX")) || ($matchFound) ){
// get IP
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
// set bogus
$bogus = "1";
}
}
}
add
Code: Select all
if ($bogus != "1") {
close it with
Code: Select all
}
The
Code: Select all
if ($bogus != "1") {
Just a quick hack in 2.3.0.2 and using this along with a captcha it has cut my received spam down to almost nothing.
Mike