Welcome Guest, Not a member yet? Register   Sign In
To many redirect
#8

(12-28-2020, 02:45 AM)demyr Wrote: Can you please paste here your home or index method in your controller ?
And also router please. If you can provide some code samples here, we will have a chance to diagnose it directly.
BELOW THE CODE OUT  MY CONTROLLER - i am new to php, so i do not know which part of the code is needed...  

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
* Class Frontend_Controller
*/
class Frontend_Controller extends MX_Controller
{
    public $settings;

    /**
    * Frontend_Controller constructor.
    */
    public function __construct()
    {
        parent::__construct();

        $this->load->model("pages/pages_model");

        $this->init();
    }

    public function init()
    {
        $this->config->set_item('base_url', '/');

        $config = [
            'paths' => ['./application/modules/', VIEWPATH],
        ];
        $this->load->library('twig', $config);

        // Blog instellingen ophalen
        $this->load->model("blog/blogsettings_model", "blogsettings_model");
        $blog_page = $this->pages_model->get($this->blogsettings_model->get()["id_page"]);
        $this->settings["blog"]["page"] = $blog_page;

        // Maand namen bepalen
        $this->months = ["", "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"];
    }

    /**
    * @param $tpl
    * @param array $args
    */
    public function tpl($tpl, $args = [])
    {
        $args["is_admin"] = $this->session->userdata("hash") ? 1 : 0;
        $args["settings"] = $this->settings;
        $args["base_url"] = '/';
        $args['copy_date']  = date('Y');

        echo $this->twig->render($tpl, $args);
    }
}

/**
* Class Backend_Controller
*/
class Backend_Controller extends MX_Controller
{
    /**
    * Backend_Controller constructor.
    */
    public function __construct()
    {
        parent::__construct();

        $this->init();
    }

    /**
    *
    */
    public function init()
    {
        $this->load->model("administrators/administrators_model");

        $this->config->set_item('base_url','/admin');

        $this->authorised();

        $config = [
            'paths' => ['./application/modules/', VIEWPATH],
        ];
        $this->load->library('twig', $config);
    }

    /**
    * @param $tpl
    * @param array $args
    */
    public function tpl($tpl, $args = [])
    {
        $args["base_url"] = '/';

        echo $this->twig->render($tpl, $args);
    }

    /**
    *
    */
    public function authorised()
    {
        $administrator = $this->administrators_model->get_by_hash($this->session->userdata("hash"));

        if ((! $this->session->userdata("hash") && $this->uri->segment("2") != "authorised")
            || $this->session->userdata("hash") && ! $administrator["id"] && $this->uri->segment("2") != "authorised") {

            redirect("authorised");
        }
    }
}


BELOW THE CODE OUT MY ROUTER

<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";

class MY_Router extends MX_Router {}
Reply


Messages In This Thread
To many redirect - by Paula1977 - 12-23-2020, 01:02 PM
RE: To many redirect - by seunex - 12-24-2020, 01:22 AM
RE: To many redirect - by demyr - 12-24-2020, 04:40 AM
RE: To many redirect - by includebeer - 12-24-2020, 01:35 PM
RE: To many redirect - by Paula1977 - 12-27-2020, 01:40 PM
RE: To many redirect - by demyr - 12-28-2020, 02:45 AM
RE: To many redirect - by Paula1977 - 12-29-2020, 12:10 PM
RE: To many redirect - by Paula1977 - 12-28-2020, 03:18 PM
RE: To many redirect - by Chalarna - 01-20-2021, 06:14 AM
RE: To many redirect - by Cloud_Geek - 03-31-2021, 02:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB