ddos protection by cloudflare blocks extensions in opencart admin

/* 	This is an opencart issue, specifically with the annoying promotional advert
 	that pops up above the extensions when you load them up.

	To fix this: 
    
    1) Go to this file: admin/controller/extension/extension/promotion.php
    2) add this code:
   */
    
return '';

/*
	after this code:
*/

public function index() {
  
/*
	This will return nothing, instead of an advert... which is what you want
    
    The end result should look something like this:
*/
  
<?php
class ControllerExtensionExtensionPromotion extends Controller {
    public function index() {

	// return nothing, early, to avoid cloudflair issue!
	return '';
	
	$curl = curl_init();

	curl_setopt($curl, CURLOPT_URL, OPENCART_SERVER . 'index.php?route=api/promotion&type=' . substr($this->request->get['route'], strrpos($this->request->get['route'], '/') + 1));
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_HEADER, false);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
	curl_setopt($curl, CURLOPT_TIMEOUT, 30);

	$response = curl_exec($curl);

	curl_close($curl);

	if ($response) {
	    return $response;
	} else {
	    return '';
	}
    }
}

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source