Add local spammer database and spam submission API
parent
7e7f61cffb
commit
feab0c3a87
Binary file not shown.
Binary file not shown.
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
$fromemail = $VARS["email"] ?? "";
|
||||
$clientip = $VARS["ipaddr"] ?? "";
|
||||
|
||||
if (!empty($fromemail) && filter_var($fromemail, FILTER_VALIDATE_EMAIL)) {
|
||||
$fromemail = strtolower($fromemail);
|
||||
if ($database->has("net.contactspam_spammers", ["email" => $fromemail])) {
|
||||
$database->update("net.contactspam_spammers", [
|
||||
"entrylastreported" => date("Y-m-d H:i:s"),
|
||||
"reportcount[+]" => 1
|
||||
], ["email" => $fromemail]);
|
||||
} else {
|
||||
$database->insert("net.contactspam_spammers", [
|
||||
"entrylastreported" => date("Y-m-d H:i:s"),
|
||||
"reportcount" => 1,
|
||||
"email" => $fromemail
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($clientip) && filter_var($clientip, FILTER_VALIDATE_IP)) {
|
||||
if ($database->has("net.contactspam_spammers", ["ip" => $clientip])) {
|
||||
$database->update("net.contactspam_spammers", [
|
||||
"entrylastreported" => date("Y-m-d H:i:s"),
|
||||
"reportcount[+]" => 1
|
||||
], ["ip" => $clientip]);
|
||||
} else {
|
||||
$database->insert("net.contactspam_spammers", [
|
||||
"entrylastreported" => date("Y-m-d H:i:s"),
|
||||
"reportcount" => 1,
|
||||
"ip" => $clientip
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Well if we got here then the message tested negative for spam
|
||||
//
|
||||
exitWithJson(["status" => "OK"]);
|
Loading…
Reference in New Issue