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 9294537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:23:49+00:00 2026-06-18T21:23:49+00:00

I have been working on a session validation for my login to make sure

  • 0

I have been working on a session validation for my login to make sure that a user is logged in to view pages. I keep getting this error:

Fatal error: Class ‘MY_Staffcontroller’ not found in /usr/local/var/www/CodeTest
/ci/application/controllers/staff_c.php on line 3

My staff_c page looks like so :

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

class Staff_c extends MY_Staffcontroller {

    function homepage()
    {
        $data['main_content'] = 'homepage_view';
        $this->load->view('includes/template', $data);
    }
}

I have been reading same questions all over the place and they say the same thing pretty much…

Is your controller located in application/core?

Well yes it is. I can’t seem to get passed this hump!

Controller image

This is the code within My_Staffcontroller.php:

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

class MY_staffcontroller extends CI_Controller {

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

        $loggedin = $this->session->userdata('loggedin');
        if(!isset($loggedin) || $loggedin != TRUE);
        {
            die($this->load->view('denied'));
        }
    }
}

I know this is user error as this is only my second day with CodeIgniter but I can’t seem to find proper workaround for this?

I have tried this tutorial and still nothing and also this

Even following this video has me stuck on the session part.

And I just can not get this to work.

  • 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-06-18T21:23:50+00:00Added an answer on June 18, 2026 at 9:23 pm

    Remember Linux is case-sensative whereas Windows is case-insensative.

    place you’re MY_Staffcontroller inside application/core/MY_Controller.php file

    Your MY_Controller.php file should look like this (minus all you’re other functions, this is a minimal example)

    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class MY_Controller extends CI_Controller
    {
       public function __construct() 
       {
           parent::__construct(); 
       }
    }
    class MY_Staffcontroller extends MY_Controller 
    {
        public function __construct() 
        {
           parent::__construct();
        }
        public function sayHello()
        { 
            echo "Hello, I am a function within MY_Staffcontroller.php";
        }
    }
    

    Example

    This will be located in /application/controllers directory
    Basically any protected and public functions located in either MY_Controller OR MY_Staffcontroller will be accessible from derived controllers that extend the extended controller. In this case it would be MY_Staffcontroller

    class Public_Staff_Controller extends MY_Staffcontroller 
    {
        public function __construct()
        {
            parent::__construct();
        }
        public function index()
        {
            $this->sayHello();
        }
    }
    
    /* end of file /application/core/MY_Controller.php */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has been working with session variables no problem. I
I have been working on a site that displays user information on every page.
I have been working with NSArray s and NSMutableArray s that store NSDate objects
I have been working on a small project that is supposed to simulate a
I have been working on a website that has to do with a subscription
Okay I have been working on this for about 2 hours and am sure
I have been working on converting my websites session information over from flatfiles to
I have been working on application that is using spring security. I am quite
I have been working on a upload file that works fine on localhost (windows)
I have been working on saving/loading, and I came across that I have to

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.