Welcome Guest, Not a member yet? Register   Sign In
Problem when calling controller method
#12

(10-02-2018, 11:58 PM)Pertti Wrote: With AJAX trailing slash could cause problems sometimes, but don't think it's that this time.

You could put die('xxx'); as first thing in your controller method.

If xxx appears when you go to URL, it means routing works, and issue must be with rest of the controller/model code. If xxx does not appear it's either routing or __construct method where you need to dig further.

I also see you have auth as default controller, which makes me think you have some sort of authentication going on?

Putting die('xxx'); didn't work. I still get the same error message when I try to call the method (even directly from the browser address bar). This is my __construct method:

PHP Code:
function __construct() {
 
       parent::__construct();
 
       verifyAccess(true);
 
       $this->load->library([
 
           'AcessoLibrary',
 
           'ReportsLibrary',
 
           'SalesCampaignLibrary',
 
           'ClientsLibrary'
 
       ]);
 
       $this->zip->compression_level 9;
 
   

This is the verifyAccess function:
PHP Code:
function verifyAccess($loginOnly false) {
 
       $ci =& get_instance();

 
       if ($loginOnly == true) {
 
           if (!$ci->session->logged_in) {
 
               redirect('/');
 
               return false;
 
           } else {
 
               return true;
 
           }
 
       } else {
 
           if (!$ci->session->userdata('logged_in')) {
 
               redirect('/');
 
               return false;
 
           } else {
 
               
                $decodedMenu 
= (array)json_decode($ci->encryption->decrypt($ci->session->allowedURIs));
 
               $currentURI $ci->uri->uri_string();
 
               
                if 
(arrayPartialSearch($decodedMenu$currentURI) !== NULL) {
 
                   return true;
 
               } else {
 
                   redirect('/Dashboard');
 
                   return false;
 
               }
 
           }
 
       }
 
   
This function is used to validade if the current user has access to the page they're trying to open by matching the page URI with an provided array, that is sent by the server during the login process. I've removed it from the construct to see if it would change and the error persists. I load some libraries that have the methods that make the API calls. And thats pretty much it.

What bothers me most is that the server answers 404, its not CI's 404 error page.
Reply


Messages In This Thread
RE: Problem when calling controller method - by rlazarotto - 10-03-2018, 07:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB