Re: Access Blocker Support Thread
I have now resolved this issue with AB not working in production. It was a database problem.
My notes from the time show that I extracted all Messages keywords, sorted them. then pasted them back into the admin interface. I had done the same with blocked IP addresses and Blocked Email addresses. Some time after this AB stopped working.
I cleared all of the fields through the interface but it still didn't work.
A copy of the non-working production database did not work in test.
After turning off AB in the Admin interface and turning off logging I deleted the relevant database fields for AB (NOT RECOMMENDED WITHOUT BACKUPS).
On restarting the Admin console, AB was installed afresh. Appropriate keywords etc were added via the interface and AB was turned on.
It is now working and the log file can be read by "blocked_accesses.php"
NOTE: This work was performed and tested in a test environment before applying it to a production database that was taken offline.
Re: Access Blocker Support Thread
Hello, I've installed this plugin but I'm getting a blank/broken index page, log states -
PHP Parse error: syntax error, unexpected '?' in ***** /includes/classes/observers/auto.access_blocker.php on line 40
I make line 40 -
if ($this->isIpWhitelisted($_SERVER['REMOTE_ADDR'] ?? '.') === true) {
I guess that is not really an error and perhaps I need to ask for something to be updated on my server? PHP?
Could you list the requirements? Apologies if I've missed this elsewhere. The plugin looks very useful, I hope I can get it working!
Cheers
Re: Access Blocker Support Thread
Yes, that null-coalesce operator (??) requires PHP 7.4 or later. You can make an edit to your copy by changing that line 40 to the following if you're running an earlier version of PHP:
Code:
//if ($this->isIpWhitelisted($_SERVER['REMOTE_ADDR'] ?? '.') === true) {
if ($this->isIpWhitelisted((isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] ? '.')) === true) {
Re: Access Blocker Support Thread
Thanks :) ....that then gives me this error in the log:
PHP Parse error: syntax error, unexpected ')' in *** /includes/classes/observers/auto.access_blocker.php on line 41
Maybe it's best if I look into upgrading PHP on the server?
I'm not sure if that's possible or if it might break other areas of the site?! But I can ask my host....
Cheers
Re: Access Blocker Support Thread
My bad. I know better than to post code before my first cup of coffee. That last ? should be a :
//if ($this->isIpWhitelisted($_SERVER['REMOTE_ADDR'] ?? '.') === true) {
if ($this->isIpWhitelisted((isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '.')) === true) {
Re: Access Blocker Support Thread
Thank you! ...now error is unexpected '?' on line 249 which is:
$organization = $_SESSION['ipData']->company->name ?? '';
and there is another double ?? on the line below. Sorry I can't work out what to replace that with! (I'm out of practise and not very knowledgable with PHP).
Re: Access Blocker Support Thread
Quote:
Originally Posted by
teaj
Thank you! ...now error is unexpected '?' on line 249 which is:
$organization = $_SESSION['ipData']->company->name ?? '';
and there is another double ?? on the line below. Sorry I can't work out what to replace that with! (I'm out of practise and not very knowledgable with PHP).
Code:
$organization = (isset($_SESSION['ipData']->company->name)) ? $_SESSION['ipData']->company->name : '';
That's why that null-coalesce is so great; makes the code much more readable!
Re: Access Blocker Support Thread
Great, it all seems to be working now. I look forward to stopping the spammers! Thanks for your help.
1 Attachment(s)
Re: Access Blocker Support Thread
Running ZC 2.1.0
Installed Access Blocker. Struggled to get email verification to work. Ended up using a different email address which then worked. (strange) Anyway, now I'm going over the settings in ZenCart Admin and noticed. (see attached) Basically it wants a user id number from the URL at AbuseIPDB which no longer displays a user ID in the URL. So this seems to be outdated and needs correction or deletion. Or the instructions updated to be useful in finding this information for the field.
Re: Access Blocker Support Thread
Quote:
Originally Posted by
lynbor
Running ZC 2.1.0
Installed Access Blocker. Struggled to get email verification to work. Ended up using a different email address which then worked. (strange) Anyway, now I'm going over the settings in ZenCart Admin and noticed. (see attached) Basically it wants a user id number from the URL at AbuseIPDB which no longer displays a user ID in the URL. So this seems to be outdated and needs correction or deletion. Or the instructions updated to be useful in finding this information for the field.
There's no such setting for Access Blocker; perhaps you were looking for the AbuseIPDB plugin (https://www.zen-cart.com/downloads.p...file&id=2371)?