• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to locate the specified class: Session.php

#1
I have created a hook
Code:
$hook['pre_controller'] = array(
        'class'    => 'AdminAuthorization',
        'function' => 'isAuthorize',
        'filename' => 'AdminAuthorization.php',
        'filepath' => 'hooks',
        'params'   => []
);

My hook File AdminAuthorization.php
Code:
class AdminAuthorization extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }
    
    public function isAuthorize(array $params)
    {
        $classes    =    ["administrator"];
        if(in_array($this->router->class,$classes))
        {
            //Check if user is logged in or not
            $user    =    $this->session->get_userdata("user");
            if(isset($user["user_group"]) && $user["user_group"] == "2")
            {
                //Redirect to the dashboard page
            }else{
                //Redirect to the login page
                if($this->router->method != "login")
                {
                    redirect(site_url("administrator/login"));
                }
            }
        }
    }
}

My autoload.php file
$autoload['libraries'] = array('session','database','email');

Still I am getting the error Unable to locate the specified class: Session.php
Help me if I am doing anything wrong???
Reply


Messages In This Thread
Unable to locate the specified class: Session.php - by codebigneer - 10-08-2017, 10:02 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.