Due to an growing invasion of registration bots on an OpenCart website, I have decided to install CIDRAM which seems to be a robust solution to try reducing this kind of nuisance.
I though I have implemented the system correctly as log
files were effectively created and gave a list of blocked IPs. But actually, I realized that CIDRAM wasn't properly "hooked" to OpenCart: indeed, since it has been installed, some manipulations aren't possible anymore because of the following error:
SyntaxError: JSON.parse:
unexpected end of data at line 1 column 1 of the JSON data
I must have rummaged about the causes of such an error which isn't totally unknown: maintenance mode, configuration files, user API issue, etc. I have tested various of these known possible origins without success, when I found the following advice in a checklist:
Check if you have added any
$_SERVER['REMOTE_ADDR']
into an if block to reject ips on purpose.
At this point, I have to consider that the recent installation of CIDRAM can be the main cause of this error: I removed the "hook" that I had manually added in the main index.php
(before requiring vQMOD) and it resolved the error.
// OpenCart Configuration
if (is_file('config.php')) {
require_once('config.php');
}
// OpenCart Install
if (!defined('DIR_APPLICATION')) {
header('Location: install/index.php');
exit;
}
// CIDRAM Hook
require './cidram/loader.php';
// VirtualQMOD
require_once('./vqmod/vqmod.php');
VQMod::bootup();
However, I would still like to be able to properly install CIDRAM in order to fully test its features (and I have of course first ask the maintainers if they know a way to do it).
Thus, the question is now how to correctly "hook" CIDRAM to OpenCart without causing this json
errors? Is it appropriate to hook in an other page than index.php
or is it practicable to use a specific position in this main page?