Cindy - I wanted to ADD something to the script, and I'm wondering what I may be doing wrong.
The script is working great, but we have another module (the AJAX FAQ Module [https://www.zen-cart.com/downloads.php?do=file&id=1757] which lets us publish answered Questions to the product info page). This is really helpful for customers to see other asked questions without submitting the same thing over and over to us.
ANYWAY - I want to filter that AJAX FAQ form through the Access Blocker as well so that it blocks any banned IP address from submitting spam.
I tried to do this but it wasn't working:
In auto.access_blocker.php:
I added this:
$this->attach(
$this,
[
'NOTIFY_FAQ_QUESTION', // <------- I ADDED THIS NOTIFIER WHICH I CREATED IN THE FAQ Module constructor
'NOTIFY_CONTACT_US_CAPTCHA_CHECK',
'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK',
'NOTIFY_PROCESS_3RD_PARTY_LOGINS',
'NOTIFY_OPC_GUEST_CHECKOUT_OVERRIDE',
'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK',
]
)
I then copied and pasted this CASE block into the auto.access_blocker.php:
case 'NOTIFY_FAQ_QUESTION':
// -----
// If either the 'email' or 'enquiry' posted via the form is empty, perform a "quick return"
// (to prevent PHP notices generated for those 'missing' values); the base header_php.php will
// kick the request back.
//
if (empty($_POST['email_address']) ) {
return;
}
if (!$this->isEmailWhitelisted($_POST['email_address']) && ($this->isEmailAddressBlocked($_POST['email_address']))) {
$this->logBlockedAccesses('FAQ Question Submit', $_POST['email_address']);
$this->denyIfThreatAccessRestricted();
zen_redirect(zen_href_link(FILENAME_CONTACT_US, 'action=success', 'SSL'));
}
break;
That is basically the same code you have for blocking the Contact Us page, except the form field for email is different because this is how the email address field is labeled with that plugin:
<input class="form-control" type="text" name="email_address" size="50" placeholder="Please enter your email address">
Anyway, I did all that, and then added my email address to the Access Blocker's BLACKLIST, and submitted the form using my blocked email. However, the email was still delivered.
Am I missing something on how to extend the plugin to cover this form?