[eluser]Ehs4n[/eluser]
I am using MY_controller for authentication.
Inside MY_controller, i have two classes, Public_Controller & Private_Controller. Public_Controller extends Controller class and is used to load models, libraries etc while as Private_Controller extends Public_Controller and authenticates user.
The app is working fine on Windows, but is gives following error on Linux.
Fatal error: Class 'Private_Controller' not found in ..... on line 2.
It shows the error in my home controller.
Code in MY_controller
Code:
<?php if (!defined('BASEPATH')) exit('No direct access allowed.');
/**
* Extending base Controller to add custom stuff
* Accessible to all
*/
class Public_Controller extends Controller {
function Public_Controller() {
parent::Controller();
$this->load->helper(array('url', 'form', 'date'));
$this->load->library('session');
$this->load->library('util');
$this->load->library('validation');
$this->load->library('upload');
$this->load->model('user_model', 'userM');
$this->load->model('student_model', 'studentM');
$this->load->model('school_model', 'schoolM');
$this->load->model('parents_model', 'parentsM');
$this->load->model('guardian_model', 'guardianM');
$this->load->model('fee_model', 'feeM');
$this->load->model('util_model', 'utilM');
$this->load->model('transaction_model', 'transM');
$this->load->database();
$this->data->errors = '';
$this->data->messages = '';
}
}
/**
* Extending base Controller to add authentication
* Checks user access
*/
class Private_Controller extends Public_Controller {
function Private_Controller() {
parent::Public_Controller();
if(!$this->session->userdata('user')) {
redirect('user/login', 'location', 301);
} else {
$this->data->head->user = $this->session->userdata('user');
}
}
}
Code in home controller
Code:
<?php
class Home extends Private_Controller {
function Home() {
parent::Private_Controller();
}
function index() {
$this->data->head->title = 'Home';
$this->load->view('home', $this->data);
}
}
Please help me.