CodeIgniter Forums
help for profile implementation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: help for profile implementation (/showthread.php?tid=70095)



help for profile implementation - danielcr_2018 - 02-19-2018

Hi friends,

I'd like to ask for advice in a small application I'm working.
My job is to create an application with two profiles, administrator and user. For the implementation, my idea is to do a controller for each profile, and in the controller's constructor set a stop and allow entry only if the user has the correct profile.

The code is the following:

PHP Code:
class Administrator extends CI_Controller {
 
 
  public 
function __construct(){
 
   ...
    if(
$_SESSION['profile'] != 'admin'){
        
$this->load->view('error');
        
$this->output->_display();
        exit;
    }
 
 }


What do you think? 
With gratitude,
Daniel


RE: help for profile implementation - InsiteFX - 02-19-2018

For one you are going to need an auth system to handle users.

You could then create a database profile table according to
the users id for look ups.