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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:05:35+00:00 2026-05-24T02:05:35+00:00

ANSWERED! IT WAS A TYPO OMG. Always check EVERY CHARACTER I have three controllers,

  • 0

ANSWERED! IT WAS A TYPO OMG. Always check EVERY CHARACTER

I have three controllers, Site, Login and Admin. Site and Login work perfectly. I know I am logging in correctly, because I set the “incorrect username” blah blah error message, which shows up if I have incorrect login details. When I log in successfully however, I get a 500 Internal Server Error:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

Here’s the admin controller:

function __construct()
    {
        parent::Controller();
        $this->isLogged();
    }

    function isLogged()
    {
        $isLogged = $this->session->userdata('isLogged');

        if (!isset($isLogged) || $isLogged != true)
        {
            redirect('login/index');
        }
    }

    function index()
    {
        $data['metaDescription'] = 'Admin area of danaemc.com';
        $data['keywords'] = '';
        $data['title'] = 'danaemc :: admin :: home';

        $data['main_content'] = 'admin_view';
        $this->load_view('includes/admin_template', $data);
    }

In which where it tries to access index(), the 500 error happens.

If you need more code, let me know in a comment. I hope it is something obvious.

  • 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-24T02:05:36+00:00Added an answer on May 24, 2026 at 2:05 am

    Looks like a problem with your function that checks login. From the code you provide, I see this workflow:

    • User is not logged: he’s redirected to login/index and logs in.
    • I suppose then he’s redirected to admin controller, right? (when succesfully logged). Ok, now when admin controller is initialized it checks, within the controller itself, if the user is logged.
    • It is, ok, but you don’t tell it to go to some other page if the user is logged, so: you go to admin/index, but the constructor “intercepts” your request BEFORE it being routed (since the constructor is called as soon as the class is initialized, before the index() method is ever reached), and it hangs there: index() is called from the URL but the request doesn’t go past isLogged(), and this discrepancy can cause you those troubles (I had a similar problem once).

    You should do like this instead of using a controller’s method:

    function __construct()
    {
           parent::__construct();   //what is parent::Controller() you wrote??
          if(!isset($this->session->userdata('isLogged')) OR $this->session->userdata('isLogged') == FALSE)
          {
             redirect('login', 'refresh'); // 'login/index' should be automatically called
          }
    
    }
    

    Moreover, as a side note, I’d do this check in some method in a library, and have it just return TRUE/FALSE and use that in my controller’s constructor. Like

     function __construct()
     {
       parent::__construct();
       if(FALSE === $this->myauthlibrary->is_logged())
       {
         redirect('login','refresh');
       }
     }
    

    This just for the sake of business logic and encapsulation, but it’s just an idea and an advice.
    If you still want to use the isLogged() of your Controller (but in this way every controller that checks for login needs is own method…) just put an ELSE clause, that redirects to index() if the checking gives positive response.

    Edited after comment:

    By chance are you calling a favicon in your meta tags? <link rel="icon" href="http://mysite/assets/favicon.ico" /> or whatever url you have? Did you spelled it RIGHT? And don’t have a href="http://mysite/favicon_ico", which CI things is a controller?

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

Sidebar

Related Questions

ANSWERED: THE FUNCTION WORKS AS I WANTED IT TO. I HAD A TYPO IN
I just had a ridonkulous typo in my iPhone app, answered here . Now
I had a question answered which raised another one, why following does not work?
Edit: Answered my own question. See below. -_- I have a variable defined in
I answered that I will have have a 2d Array. And then I will
This question have been answered. I recommend sumit_programmers solution below. For now, I've removed
This may have been answered elsewhere but I could not find a suitable response.
I have answered it is false. then he asked why? i couldn't answer. Can
This might have been answered here before and I'm just not searching for the
After this was answered I continued to work my way through the code. It

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.