Post by straightlight » Wed Oct 18, 2017 10:11 am

For Opencart v3.0.2.0 release, I have integrated a little addon which was originally found from WeChat in:

- system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Tools.php file in order to filter the IP address . The most relevant location to where these types of verifications should be made would be on the:

- catalog/controller/api/login.php file.


Code: Select all

if (!in_array($this->request->server['REMOTE_ADDR'], $ip_data)) {
replace with:

Code: Select all

if (!in_array($this->getIpAddress(), $ip_data)) {
Then, find the last:

Code: Select all

at the end of the file. Then, add above - not below:

Code: Select all

protected function getIpAddress() {
            if (!isset($this->request->server[$header]) || ($spoof = $this->request->server[$header]) === NULL) {
            sscanf($spoof, '%[^,]', $spoof);
            if (!filter_var($spoof, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                $spoof = NULL;
            } else {
                return $spoof;
        return '';

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

Straightlight Administrator / Quality Assurance Analyst / Programmer

Legendary Member


Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 3 guests