Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7629449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:50:16+00:00 2026-05-31T05:50:16+00:00

I want to extend basic controller by my own. This is code of file

  • 0

I want to extend basic controller by my own. This is code of file MY_Secure.php which i put in application/libraries

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

Class MY_Secure extends CI_Controller {
  public function __construct() {
    parent::__construct();
    if(!$this->session->userdata('status') == 'admin') {
        $data['message'] = '<p class="error">You shold login in admin area</p>';
        $this->load->view('admin/login', $data);
    }
  }
}
?>

And here is my controller in application/controllers/category.php

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

class Category extends MY_Secure {

function __construct()
{
    parent::__construct();
}

 public function index()
{
 $data['login'] = $this->session->userdata('login');
 $data['status'] = $this->session->userdata('status');

 $this->load->model('categories_model');
 $data['main_categories'] = $this->categories_model->get_main_categories();

 $this->load->view('admin/headers/main', $data);
 $this->load->view('admin/category');
 $this->load->view('admin/footer/main');
}
?>

But i have an error Fatal error: Class 'MY_Secure' not found in Z:\home\ci.local\www\application\controllers\admin\category.php on line 3 How can i avoid this error? What i do wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:50:17+00:00Added an answer on May 31, 2026 at 5:50 am

    http://codeigniter.com/forums/viewthread/182186/#862394

    …so put MY_Secure.php MY_Controller.php in application/core

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to extend a WPF application with database functionality. Which database engine would
I want to extend the basic ControlCollection in VB.NET so I can just add
I want to extend an existing application I made to make it set mixer
I want to extend a web server which is only able to handle RPC
I have a SVG file that I want to extend by adding onclick handlers
In following code, I want to extend the behaviour of a class by deriving/subclassing
I have a static class in a shared project, which I want to extend
I have the following code, which generates a basic layout for my app: tabpanel
I've got this to work using a very basic example(outlined below) and I want
I want to extend the Nokohiri::XML::Node object into my own unique object with custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.