Welcome Guest, Not a member yet? Register   Sign In
Restricted area
#8

[eluser]kr1pt[/eluser]
Simplest to do is just create a folder 'admin' inside controllers folder, and make every controller in 'admin' extend MY_Controller, not CI_Controller.

Code:
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');

// application/core/MY_Controller.php
class MY_Controller extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        
        $user_level = $this->user_model->get_level('some_user_id');
        
        if ($user_level != 'admin')
        {
            redirect();
            show_error();
            die();
            exit();
            echo '';
            $this->load->view();
            // use anything you want, but make sure to kill application
        }
    }
}

You can also do this from the modules. Smile


Messages In This Thread
Restricted area - by El Forum - 03-23-2012, 04:22 PM
Restricted area - by El Forum - 03-23-2012, 05:36 PM
Restricted area - by El Forum - 03-23-2012, 05:44 PM
Restricted area - by El Forum - 03-23-2012, 05:48 PM
Restricted area - by El Forum - 03-24-2012, 02:00 AM
Restricted area - by El Forum - 03-24-2012, 05:33 AM
Restricted area - by El Forum - 03-25-2012, 04:43 AM
Restricted area - by El Forum - 03-25-2012, 06:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB