skip to Main Content

I recently downloaded a free copy of a school management system built in PHP/CodeIgniter and installed it on my cpanel shared hosting server. I have followed the installation instructions and made the necessary changes to the database and route files but I always get an ‘Unauthorized!’ error when i load the application in the browser where the login page is supposed to come up.
I am not sure if i am getting the routes wrong because i installed the app into a sub folder in the public_html folder.
Can anyone give me advice on what i may be doing wrong. I have been at it since the past 72 hours. I am now confused as per the routes since the application was not deployed to the root of the domain. Any help will be highly appreciated.

the code below i have been changing with no luck:

$route['default_controller'] = 'login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

2

Answers


  1. Did you checked your database.php file

    application -> config -> database.php

    check the details it should be like this:

    $db['default'] = array(
        'dsn'   => '',
        'hostname' => 'localhost',
        'username' => 'user_name',
        'password' => 'your_password',
        'database' => 'db_name',
        'dbdriver' => 'mysqli',
        'dbprefix' => '',
        'pconnect' => FALSE,
        'db_debug' => (ENVIRONMENT !== 'production'),
        'cache_on' => FALSE,
        'cachedir' => '',
        'char_set' => 'utf8',
        'dbcollat' => 'utf8_general_ci',
        'swap_pre' => '',
        'encrypt' => FALSE,
        'compress' => FALSE,
        'stricton' => FALSE,
        'failover' => array(),
        'save_queries' => TRUE
    );
    
    Login or Signup to reply.
  2. I got the same error when installing the same project; the issue came in the Login controller. You have to remove the link to install process and make it just connect directly to the database without any effort.

    Change the present index function to this;

    public function index() {
       
       //$results = $this->unlinkInstaller();
    
        if ($this->session->userdata('admin_login') == 1)
            redirect(base_url() . '/admin/dashboard', 'refresh');
    
        if ($this->session->userdata('teacher_login') == 1)
            redirect(base_url() . '/teacher/dashboard', 'refresh');
            
        if ($this->session->userdata('librarian_login') == 1)
            redirect(base_url() . '/librarian/dashboard', 'refresh');
            
            if ($this->session->userdata('accountant_login') == 1)
            redirect(base_url() . '/accountant/dashboard', 'refresh');
            
            if ($this->session->userdata('hostel_login') == 1)
            redirect(base_url() . '/hostel/dashboard', 'refresh');
    
        if ($this->session->userdata('student_login') == 1)
            redirect(base_url() . '/student/dashboard', 'refresh');
    
        if ($this->session->userdata('parent_login') == 1)
            redirect(base_url() . '/parents/dashboard', 'refresh');
    
        // if ($results['RESULT'] == 'INVALID' || $results['RESULT'] == 'EMPTY' || $results['RESULT'] == 'INVALID_DOMAIN') {
        //     $this->load->view('backend/error');
        // } else {
        //     $this->load->view('backend/login');
        // }
    
        $this->load->view('backend/login');
    }
    

    You can see that I just commented the first line to avoid going through installation process.

    //$results = $this->unlinkInstaller();

    Hope it still usefull.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search